FutureGroup<T> class
Null safety
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
- hashCode → int
-
The hash code for this object.
read-onlyinherited
- isClosed → bool
-
Whether the group is closed, meaning that no more futures may be added.
read-only
- isIdle → bool
-
Whether this group contains no futures.
read-only
- onIdle → Stream
-
A broadcast stream that emits an event whenever this group becomes idle.
read-only
- runtimeType → Type
-
A representation of the runtime type of the object.
read-onlyinherited
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 -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited