newStateTransition method
Create a new StateTransition for this StateMachine.
name helps identify the transition for debugging purposes.
This transition will only succeed when this StateMachine
is in one of the states listed in from. When this transition
occurs, this StateMachine will move to the to state.
Implementation
StateTransition newStateTransition(String name, List<State> from, State to) {
if (_started)
throw IllegalStateMachineMutation(
'Cannot create new state transition ($name) once the machine has been started.');
StateTransition newTransition = StateTransition._(name, this, from, to);
manageDisposable(newTransition);
return newTransition;
}