stated_result library

Classes

ActionResult
A 2-state result represents synchronised action with no return value It could be either succeeded or failed
AsyncActionResult
A 4-state result represents asychronised action with no return value It could be either pending, waiting, succeeded, or failed
AsyncQueryResult<T>
A 4-state result represents asychronised query with single query value It could be either pending, waiting, succeeded, or failed
CompletedResult
State indicates the action is completed successfully
ErrorWithStack
Error and its stack trace
FailedResult
State indicates the query/action is failed
InitialValueResult<T>
State indicates the query has not been started yet, but provided with a default initial value
PendingResult
State indicates the query/action hasn't started yet
QueryResult<T>
A 2-state result represents synchronised query with single return value It could be either succeeded or failed
SucceededResult<T>
State indicates the query is finished successfully
ValueResult<T>
Contract for any state result with a value
WaitingResult
State indicates the action/query has been started but not yet finished

Extensions

ActionResultFutureExtension on Future
Provides extension methods on Future for ActionResult
QueryResultFutureExtension on Future<T>
Provides extension methods on Future<T> for QueryResult

Typedefs

FailedResultMapper<TR> = TR Function(FailedResult result)
Mapper fucntion for result state has error
ResultMapper<TR> = TR Function()
Mapper function for general result state
ValueMapper<T, TR> = TR Function(T value)
ValueResultMapper<T, TR> = TR Function(ValueResult<T> result)
Mapper function for result state with value