WhenFuture<T> class
A utitlity that asynchronously creates a single value from a Future.
By using WhenFuture, the code dependent on the result will be able to read the state of the asynchronous computation synchronously, handle the loading/error/finalize states, and complete when the computation completes.
A common use-case for When is to easily consume states of an asynchronous operation such as reading a file or making an HTTP request.
Constructors
-
WhenFuture(Future<
T> createFuture()) -
WhenFuture.value(Future<
T> future)
Properties
-
asyncValue
→ Future<
T> -
no setterinherited
- hashCode → int
-
The hash code for this object.
no setterinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
-
valueBuilder
→ AsyncResultBuilderCallback<
Future< T> > -
no setterinherited
Methods
-
buildAsyncValue(
) → void -
inherited
-
execute(
{VoidCallback? onLoading, VoidValueCallback< T> ? onComplete, VoidErrorCallback? onError, VoidCallback? onFinally}) → Future<void> -
Asynchronously executes a computation once with listener callbacks in parameters for the asynchronous computation that may fail into something that is safe to read.
override
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
recreate(
) → When< Future< T> , T> -
Recreates a when instance from the given async builder.
override
-
refresh(
{VoidCallback? onLoading, VoidValueCallback? onComplete, VoidErrorCallback? onError, VoidCallback? onFinally}) → Future< void> -
Asynchronously executes a computation with listener callbacks in parameters for the asynchronous computation that may fail into something that is safe to read.
inherited
-
refreshSnapshots(
AsyncSnapshotListenerCallback< T, AsyncSnapshot< listener, [VoidCallback? onFinally]) → Future<T> >void> -
Asynchronously executes a computation with listener callbacks in parameters for the asynchronous computation that may fail into something that is safe to read.
inherited
-
snapshots(
FutureSnapshotListenerCallback< T> listener, [VoidCallback? onFinally]) → Future<void> -
Asynchronously executes a computation once with snapshots callbacks in parameters for the asynchronous computation that may fail into something that is safe to read.
override
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited