FutureGroup< T> class
A collection of futures waits until all added Futures complete.
Futures are added to the group with add. Once you're finished adding futures, signal that by calling close. Then, once all added futures have completed, future will complete with a list of values from the futures in the group, in the order they were added.
If any added future completes with an error, future will emit that error and the group will be closed, regardless of the state of other futures in the group.
This is similar to Future.wait with eagerError
set to true
, except
that a FutureGroup can have futures added gradually over time rather than
needing them all at once.
Constructors
Properties
-
future
→ Future<
List< T>> -
The future that fires once close has been called and all futures in the
group have completed. [...]
read-only
- isIdle → bool
-
Whether this group has no pending futures.
read-only
- onIdle → Stream
-
A broadcast stream that emits a
null
event whenever the last pending future in this group completes. [...]read-only - hashCode → int
-
The hash code for this object. [...]
read-only, inherited
- runtimeType → Type
-
A representation of the runtime type of the object.
read-only, inherited
Methods
-
add(
Future< T> task) → void -
Wait for
task
to complete.override -
close(
) → void -
Signals to the group that the caller is done adding futures, and so
future should fire once all added futures have completed.
override
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a non-existent method or property is accessed. [...]
inherited
-
toString(
) → String -
Returns a string representation of this object.
inherited
Operators
-
operator ==(
dynamic other) → bool -
The equality operator. [...]
inherited