AsyncState<T> class sealed

The retained outcome of asynchronous work, independent of UI subscriptions.

States compare by value, so a listener that selects one part of a larger state with mapValue can skip rebuilds while that part is unchanged. Call withoutCarriedValue first to also skip them on progress updates. Equality ignores the type argument, so const AsyncLoading() equals an AsyncLoading<User>().

Implementers

Properties

hashCode → int
The hash code for this object.
no setterinherited
hasValue → bool
Whether a value is available: an AsyncData, or an AsyncLoading or AsyncError created with withValue.
no setter
requireValue → T
The available value (see hasValue).
no setter
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited
valueOrNull → T?
The available value (see hasValue), otherwise null.
no setter

Methods

mapValue<R>(R transform(T value)) → AsyncState<R>
Transforms the value, keeping the kind of state.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toError(Object error, StackTrace stackTrace) → AsyncError<T>
A failed state that keeps the current value, for reporting a failure.
toLoading() → AsyncLoading<T>
A loading state that keeps the current value, for refreshing a result while it stays visible.
toString() → String
A string representation of this object.
inherited
withoutCarriedValue() → AsyncState<T>
This state without the value a loading or error state carries.

Operators

operator ==(Object other) → bool
The equality operator.
inherited