execute method
Change the current state by performing an action.
@param action The action to perform. @return True if the action was able to be performed and the state machine moved to a new state, false if the action was unable to be performed.
Implementation
bool execute(String action) {
// print('< States -> execute: ${action}');
for (var transition in _transitions) {
if (transition.at == _currentStateMeta && transition.action == action) {
// print('<< transition: ${transition}');
_changeCurrentStateWithTransition(transition);
return true;
}
}
return false;
}