dart_fsm library

Classes

AfterSideEffect<STATE extends Object, ACTION extends Object>
A type of SideEffect which is executed after the ACTION is dispatched and then the STATE is changed accordingly. This SideEffect is executed only when the transition is successfully made.
AfterSideEffectCreator<STATE extends Object, ACTION extends Object, SIDE_EFFECT extends AfterSideEffect<Object, Object>>
Interface of the class that generates SideEffect after the transition
BeforeSideEffect<STATE extends Object, ACTION extends Object>
A type of SideEffect executed after the ACTION is dispatched, before the STATE is changed, and regardless of whether the transition is made.
BeforeSideEffectCreator<STATE extends Object, ACTION extends Object, SIDE_EFFECT extends BeforeSideEffect<Object, Object>>
Interface of the class that generates SideEffect before the transition
FinallySideEffect<STATE extends Object, ACTION extends Object>
A type of SideEffect executed after the ACTION is dispatched, after all other processes are finished, and regardless of whether the transition is made.
FinallySideEffectCreator<STATE extends Object, ACTION extends Object, SIDE_EFFECT extends FinallySideEffect<Object, Object>>
Interface of the class that generates SideEffect that is executed at the end of the process when an Action is dispatched regardless of whether a transition is made
GraphBuilder<STATE extends Object, ACTION extends Object>
A builder for building the Graph
Invalid<STATE extends Object, ACTION extends Object>
A class representing the state transition pattern when the transition is invalid. It has the same state before the transition and the action as Transition, but it does not have the state after the transition.
StateMachine<STATE extends Object, ACTION extends Object>
A state machine.
Subscription<STATE extends Object, ACTION extends Object>
Subscription is a component which can be registered to StateMachine to monitor changes of the state. This is mainly used to monitor a change in state and to instruct StateMachine to perform some processing based on that change. For example, it is conceivable to monitor the connection status of WebSocket and instruct StateMachine to attempt to reconnect if the connection is lost.
Transition<STATE extends Object, ACTION extends Object>
A parent class for representing state transition patterns The parent of Valid and Invalid class, which holds the state before the transition and the action which caused the transition.
Valid<STATE extends Object, ACTION extends Object>
A class representing the state transition pattern when the transition is valid. In addition to the properties defined by the parent(Transition) it also holds the state after the transition.The state before the transition and the action are inherited from Transition, and the state after the transition is added.

Functions

createStateMachine<STATE extends Object, ACTION extends Object>({required GraphBuilder<STATE, ACTION> graphBuilder, required STATE initialState, List<SideEffectCreator<Object, Object, SideEffect>> sideEffectCreators = const [], List<Subscription<STATE, ACTION>> subscriptions = const []}) StateMachine<STATE, ACTION>
This function creates a StateMachine with the given graphBuilder, initialState, sideEffectCreators, and subscriptions. This function exists to hide StateMachineImpl.