Last active
August 29, 2015 14:03
-
-
Save TrainerGuy22/c6eeddcb6f5205aa3838 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
part of dartboard; | |
class FutureGroup { | |
Completer _completer = new Completer(); | |
List<Future> _futures = <Future>[]; | |
FutureGroup(); | |
bool add(Future future) { | |
if(!_futures.contains(future)) { | |
_futures.add(future); | |
return true; | |
} | |
return false; | |
} | |
Future wait() { | |
Future.wait(_futures).then((List result) { | |
_completer.complete(result); | |
})..catchError((err) => _completer.completeError(err)); | |
return _completer.future; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
NOTICE