When<ASYNC_RESULT_TYPE, RESULT_TYPE> class
abstract
A utitlity that asynchronously creates a single value.
By using When, 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.
- Implementers
Constructors
-
When(AsyncResultBuilderCallback<
ASYNC_RESULT_TYPE> builder) - When.value(ASYNC_RESULT_TYPE value)
Properties
- asyncValue → ASYNC_RESULT_TYPE
-
no setter
- 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<
ASYNC_RESULT_TYPE> -
no setter
Methods
-
buildAsyncValue(
) → void -
execute(
{VoidCallback? onLoading, VoidValueCallback? 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.
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
recreate(
) → When< ASYNC_RESULT_TYPE, RESULT_TYPE> - Recreates a when instance from the given async builder.
-
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.
-
refreshSnapshots(
AsyncSnapshotListenerCallback< RESULT_TYPE, AsyncSnapshot< listener, [VoidCallback? onFinally]) → Future<RESULT_TYPE> >void> - Asynchronously executes a computation with listener callbacks in parameters for the asynchronous computation that may fail into something that is safe to read.
-
snapshots(
AsyncSnapshotListenerCallback< RESULT_TYPE, AsyncSnapshot< listener, [VoidCallback? onFinally]) → Future<RESULT_TYPE> >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.
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited
Static Methods
-
future<
RESULT_TYPE> (AsyncResultBuilderCallback< Future< asyncValueBuilder) → WhenFuture<RESULT_TYPE> >RESULT_TYPE> - A utility that uses WhenFuture for executing Futures with snapshots.