AsyncValue<T> class sealed Async Value

Implementers

Constructors

AsyncValue()
const
AsyncValue.data(T data)
Constructs an AsyncValue.
const
factory
AsyncValue.error(Object error, StackTrace stackTrace, [T? prev])
Constructs an AsyncError.
const
factory
AsyncValue.loading([T? prev])
Constructs an AsyncLoading.
const
factory

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 R while 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 skipLoading is true and there is previous data, the result of data will be returned instead of loading. If skipError is true and there is previous data, the result of data will be returned instead of error.

Operators

operator ==(Object other) bool
The equality operator.
override