AsyncError<T> class
The state of an AsyncValue when the asynchronous operation has failed.
- Inheritance
-
- Object
- AsyncValue<
T> - AsyncError
Constructors
-
AsyncError(Object error, StackTrace stackTrace, {AsyncData<
T> ? previous}) -
Creates an AsyncError state with the given
errorandstackTrace.const
Properties
- data → T?
-
Returns the value if the state is AsyncData, otherwise
null.no setterinherited - error → Object
-
The error object.
final
- hasData → bool
-
Alias for hasValue.
no setterinherited
- hasError → bool
-
Returns
trueif the state is AsyncError.no setterinherited - hashCode → int
-
The hash code for this object.
no setteroverride
- hasValue → bool
-
Returns
trueif the state is AsyncData.no setterinherited - isLoading → bool
-
Returns
trueif the state is AsyncLoading.no setterinherited - isRefreshing → bool
-
Whether a loading state is refreshing previously loaded data.
no setterinherited
-
previous
→ AsyncData<
T> ? -
Data retained when a refresh fails.
final
- requireValue → T
-
Returns the value if the state is AsyncData, otherwise throws a StateError.
no setterinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- stackTrace → StackTrace
-
The stack trace.
final
- valueOrNull → T?
-
Returns the value if the state is AsyncData, otherwise
null.no setterinherited
Methods
-
map<
R> ({required R data(AsyncData< T> data), required R loading(AsyncLoading<T> loading), required R error(AsyncError<T> error)}) → R -
Transforms the state to another type by matching the wrapper class.
override
-
maybeMap<
R> ({R data(AsyncData< T> data)?, R loading(AsyncLoading<T> loading)?, R error(AsyncError<T> error)?, required R orElse()}) → R -
Transforms the state to another type by matching the wrapper class, falling back to
orElseif unmatched.override -
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toString(
) → String -
A string representation of this object.
override
-
when<
R> ({required R data(T data), required R loading(), required R error(Object error, StackTrace stackTrace)}) → R -
Pattern matching method to execute different callbacks depending on the current state.
override
Operators
-
operator ==(
Object other) → bool -
The equality operator.
override