stated library

Classes

FailedState
State indicates the action is failed with error
FailedValueState<T>
State indicates the action is failed with error, and a value
IdleState
State indicates the action haven't started yet
IdleValueState<T>
State indicates the action haven't started yet, with a value
OnState<TS extends Stated>
Describe a pattern to test against Stated when whether it is a TS with extra criteria OnState.matches returns true if pattern matches.
SucceededState
State indicates the action is completed successfully
SucceededValueState<T>
State indicates the action is completed successfully with value
WorkingState
State indicates the action is in progress
WorkingValueState<T>
State indicates the action is in progress, with a value

Mixins

HasError
HasValue<T>
Contract for state holds value
HasValueAndError<T>
Contract for state implements both HasValue and HasError contracts.
Stated
Beaviour to find out the type's state

Typedefs

StatedPredict = bool Function(Stated stated)
Determine whether stated matches or not
StateTransformer<TR> = TR Function()
ValueTransformer<T, TR> = TR Function(T value)
Transformer for state with value