AsyncValue<T> class
sealed
Async Value
- Implementers
Constructors
- AsyncValue.data(T data)
-
Constructs an AsyncValue.
constfactory
- AsyncValue.error(Object error, StackTrace stackTrace, [T? prev])
-
Constructs an AsyncError.
constfactory
- AsyncValue.loading([T? prev])
-
Constructs an AsyncLoading.
constfactory
Properties
- data → T?
-
The data of an AsyncValue.
Is always
T(non-null) if the state is AsyncData.no setter - error → Object?
-
The error of an AsyncValue.
Is not null if the state is AsyncError.
no setter
- hasData → bool
-
Whether the state is AsyncData.
no setter
- hasError → bool
-
Whether the state is AsyncError.
no setter
- hashCode → int
-
The hash code for this object.
no setteroverride
- isLoading → bool
-
Whether the state is AsyncLoading.
no setter
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- stackTrace → StackTrace?
-
The stack trace of an AsyncValue.
Is not null if the state is AsyncError.
no setter
Methods
-
map<
R> (R mapper(T data)) → AsyncValue< R> -
Maps the data type of this AsyncValue to
Rwhile preserving the loading and error state. This can be used to add additional data to the AsyncValue. -
maybeWhen<
R> ({R data(T data)?, R loading()?, R error(Object error, StackTrace stackTrace)?, required R orElse(), bool skipLoading = true, bool skipError = false}) → R - Syntactic sugar for AsyncValue.
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toString(
) → String -
A string representation of this object.
inherited
-
when<
R> ({required R data(T data), required R loading(), required R error(Object error, StackTrace stackTrace), bool skipLoading = true, bool skipError = false}) → R -
Syntactic sugar for AsyncValue.
If
skipLoadingis true and there is previous data, the result ofdatawill be returned instead ofloading. IfskipErroris true and there is previous data, the result ofdatawill be returned instead oferror.
Operators
-
operator ==(
Object other) → bool -
The equality operator.
override