AsyncError<T> class
final
Represents the error state of an async operation.
This state indicates that an async operation failed with an error.
Example:
final state = AsyncError('Something went wrong', stackTrace);
print(state.isError); // true
print(state.error); // 'Something went wrong'
- Inheritance
-
- Object
- AsyncState<
T> - AsyncError
Constructors
- AsyncError(Object? error, [StackTrace? stackTrace])
-
Creates an error state with the given error and optional stack trace.
const
Properties
- data → T?
-
The data from the async operation, if available.
no setterinherited
- error → Object?
-
The error from the async operation, if any.
final
- hashCode → int
-
The hash code for this object.
no setterinherited
- isError → bool
-
Whether this state represents an error.
no setterinherited
- isLoading → bool
-
Whether this state represents a loading operation.
no setterinherited
- isSuccess → bool
-
Whether this state represents a successful operation with data.
no setterinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- stackTrace → StackTrace?
-
The stack trace from the async operation error, if any.
final
Methods
-
map<
R> ({R loading()?, R success(T)?, R error(Object?, StackTrace?)?}) → R? -
Maps the async state to a value based on its current state.
inherited
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited