AsyncActionResult class abstract

A 4-state result represents asychronised action with no return value It could be either pending, waiting, succeeded, or failed

Typically used with Bloc or ValueNotifier

AsyncActionResult.pending creates the PendingResult, indicates the action hasn't started AsyncActionResult.waiting creates the WaitingResult, indicates the action is in progress AsyncActionResult.completed creates the CompletedResult, indicates the action is completed AsyncActionResult.failed creates the FailedResult, indicates the action is failed

See also

Implemented types

Constructors

AsyncActionResult()
Alias to AsyncActionResult.pending
factory
AsyncActionResult.completed()
Creates the CompletedResult, indicates the action is completed
factory
AsyncActionResult.failed(dynamic error, [StackTrace? stackTrace])
Creates the FailedResult, indicates the action is failed
const
factory
AsyncActionResult.from(StatedResult result)
Create AsyncActionResult from any other result
factory
AsyncActionResult.pending()
Creates the PendingResult, indicates the action hasn't started
factory
AsyncActionResult.waiting()
Creates the WaitingResult, indicates the action is in progress
factory

Properties

hashCode int
The hash code for this object.
no setterinherited
hasValue bool
Return true when query resut has a value, either it is intial value or the result after running query It also indicates whether state implemented the ValueResult contract, regardless the type of the value
no setterinherited
isFailed bool
Return ture when the query/action has finished with error
no setterinherited
isFinished bool
Return true when query/action has been finished either with or without error
no setterinherited
isNotStarted bool
Return true when query/action hasn't been started
no setterinherited
isSucceeded bool
Return true when query/action has finished successfully, regardless it is an action or query
no setterinherited
isWaiting bool
Return true when query/action is being processed
no setterinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

asFailed() FailedResult
inherited
asValueResult<T>() ValueResult<T>
inherited
map<TR>({required ResultMapper<TR> pending, required ResultMapper<TR> waiting, required ResultMapper<TR> completed, required FailedResultMapper<TR> failed}) → TR
Pattern match the result on all branches
mapOr<TR>({ResultMapper<TR>? pending, ResultMapper<TR>? waiting, ResultMapper<TR>? completed, FailedResultMapper<TR>? failed, ResultMapper<TR>? finished, required ResultMapper<TR> orElse}) → TR
Pattern match the result with else branch
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<ActionResult> future) Stream<AsyncActionResult>
Update self with future ActionResult

Operators

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