on method

bool on(
  1. String action,
  2. StatesTransitionHandler handler
)
override

Adds handler to the specific action

@param action The action to which assign handler. @param handler StatesTransitionHandler which will executed on specified action @return True if the action is transition with specified action registered in the states.

Implementation

bool on(String action, StatesTransitionHandler handler) {
  for (var transition in _transitions) {
    if (transition.action == action) {
      transition.append(handler);
      return true;
    }
  }
  return false;
}