rx_state_machine library

A reactive finite state machine for Dart.

Create a machine with RxStateMachine.create, describe its states, events and transitions through a GraphBuilder, then drive it with RxStateMachine.transition and observe it via RxStateMachine.states.

Classes

Graph<STATE, EVENT, SIDE_EFFECT>
The immutable description of a state machine: its initial state, finish states, state definitions and transition listeners.
GraphBuilder<STATE, EVENT, SIDE_EFFECT>
Builds a Graph for an RxStateMachine.
Invalid<STATE, EVENT, SIDE_EFFECT>
A transition that was rejected because the current state does not handle the event. The state machine stays in fromState.
RxStateMachine<STATE, EVENT, SIDE_EFFECT>
A finite state machine whose current state can be observed as a stream.
StateDefinitionBuilder<S extends STATE, STATE, EVENT, SIDE_EFFECT>
Defines the transitions and listeners of the state S.
Transition<STATE, EVENT, SIDE_EFFECT>
The result of feeding an event into an RxStateMachine.
TransitionTo<STATE, SIDE_EFFECT>
The target of a transition, created with StateDefinitionBuilder.transitionTo.
Valid<STATE, EVENT, SIDE_EFFECT>
A transition that moved the state machine into a new state.

Typedefs

BuildGraph<STATE, EVENT, SIDE_EFFECT> = void Function(GraphBuilder<STATE, EVENT, SIDE_EFFECT>)
Configures a state machine graph through a GraphBuilder.
BuildState<S extends STATE, STATE, EVENT, SIDE_EFFECT> = dynamic Function(StateDefinitionBuilder<S, STATE, EVENT, SIDE_EFFECT>)
Configures a state through a StateDefinitionBuilder.
CreateTransitionTo<S extends STATE, STATE, E extends EVENT, EVENT, SIDE_EFFECT> = TransitionTo<STATE, SIDE_EFFECT> Function(S s, E e)
Creates the TransitionTo for an event of type E in state S.
TransitionListener<STATE, EVENT, SIDE_EFFECT> = void Function(Transition<STATE, EVENT, SIDE_EFFECT>)
Called with every Transition of a state machine.
VoidCallback<T> = void Function(T)
A callback that receives a single value of type T.