CoderAsync<T> class
CoderAsync is a wrapper for managing the async state of any asynchronous operation. It provides a CoderState of CoderAsyncState which holds loading, data, and error information.
Constructors
Properties
- data → T?
-
Accessor for the data.
no setter
- error → String?
-
Accessor for the error message.
no setter
- hasData → bool
-
Whether the async task has successfully returned data.
no setter
- hasError → bool
-
Whether an error occurred during the async task.
no setter
- hashCode → int
-
The hash code for this object.
no setterinherited
- isLoading → bool
-
Whether the current state is loading.
no setter
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
-
state
→ CoderState<
CoderAsyncState< T> > -
Holds the current state of the async operation (loading, data, error).
final
Methods
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
reset(
) → void - Resets the async state back to idle.
-
run(
Future< T> task()) → Future<void> - Runs the asynchronous task and updates the state accordingly.
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited