AsyncActionResult class abstract
A type represents the result of a async action.
AsyncActionResult.idle creates the IdleState, indicates the action hasn't started AsyncActionResult.working creates the WorkingState, indicates the action is in progress AsyncActionResult.succeeded creates the SucceededState, indicates the action is completed AsyncActionResult.failed creates the FailedState, indicates the action is failed
See also
- Implemented types
- Available Extensions
Constructors
- AsyncActionResult()
-
Alias to AsyncActionResult.idle
factory
- AsyncActionResult.failed(Object error)
-
creates a AsyncActionResult in FailedState with
error
constfactory - AsyncActionResult.from(Stated other)
-
Create AsyncActionResult from other Stated types
factory
- AsyncActionResult.idle()
-
Creates a AsyncActionResult in IdleState
This factory always returns a const result
factory
- AsyncActionResult.succeeded()
-
Creates a AsyncActionResult in SucceededState
This factory always returns a const result
factory
- AsyncActionResult.working()
-
Creates a AsyncActionResult in WorkingState
This factory always returns a const result
factory
Properties
- hasError → bool
-
Return true if it has error
no setterinherited
- hashCode → int
-
The hash code for this object.
no setterinherited
- hasValue → bool
-
Return true if it has a value
no setterinherited
- isFailed → bool
-
Return true if it is failed with error
no setterinherited
- isFinished → bool
-
Return true if it is finished, either succeeded or failed
no setterinherited
- isIdle → bool
-
Return true if it is idle
no setterinherited
- isSucceeded → bool
-
Return true if it is succeeded
no setterinherited
- isWorking → bool
-
Return true if it is in progress
no setterinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
extractError(
) → Object -
Extract error or exception
inherited
-
extractValue<
T> () → T -
Extract the value
inherited
-
map<
TR> ({required StateTransformer< TR> idle, required StateTransformer<TR> working, required StateTransformer<TR> completed, required ValueTransformer<Object, TR> failed}) → TR - Pattern match the result on all branches
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toString(
) → String -
A string representation of this object.
inherited
-
updateWith(
Future future, void emit(AsyncActionResult value)) → Future< void> -
emit AsyncActionResult.working and then the other AsyncActionResult based on the
future
's result.
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited