Skip to content


Subversion checkout URL

You can clone with
Download ZIP


Returning future on HipsterCollection.fetch #3

wants to merge 1 commit into from

2 participants


No description provided.


Ah, you're right, of course. The fetch() method would be silly without returning a future. But again, this need to run through HipsterSync, which does return a future.

I believe that, if you switch to something after_call ='read', this);, then you ought to be able to achieve the same results. That is after_call.then .... and then return after_call. If you have time, please give it a try. Otherwise I'll add it in there in a bit.

Thanks again for the PRs. Sorry about the ridiculous delay.

@eee-c eee-c closed this pull request from a commit
@eee-c Collection methods should return futures.
Fixes #3
@eee-c eee-c closed this in ed31db5
@amiuhle amiuhle deleted the amiuhle:collection-fetch-future branch
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Jul 5, 2012
  1. @amiuhle
This page is out of date. Refresh to see the latest.
Showing with 13 additions and 4 deletions.
  1. +13 −4 HipsterCollection.dart
17 HipsterCollection.dart
@@ -35,15 +35,24 @@ class HipsterCollection implements Collection {
return ret;
- fetch() {
- HipsterSync.
- call('read', this).
- then((list) {
+ Future<HipsterCollection> fetch() {
+ Completer completer = new Completer();
+ Future after_call ='read', this);
+ after_call.then((list) {
list.forEach((attrs) {
on.load.dispatch(new CollectionEvent('load', this));
+ completer.complete(this);
+ after_call.handleException((e) {
+ completer.completeException(e);
+ return true;
+ });
+ return completer.future;
create(attrs) {
Something went wrong with that request. Please try again.