getTransitions method

List<TransitionDefinition<Event>> getTransitions({
  1. bool includeInherited = true,
})

Returns the set of transitions 'from' this state. As a state inherits any transitions defined by an ancestor this method also returns the transistions for all ancestors by default.

The transitions are ordered from leaf to root.

Set includeInherited to false to exclude inherited transitions.

Implementation

List<TransitionDefinition<Event>> getTransitions(
    {bool includeInherited = true}) {
  final transitionDefinitions = <TransitionDefinition<Event>>[];

  for (final transitions in _eventTranstionsMap.values) {
    transitionDefinitions.addAll(transitions);
  }

  /// add inherited transitions.
  if (includeInherited) {
    var parent = this.parent!;
    while (parent.stateType != VirtualRoot) {
      transitionDefinitions.addAll(parent.getTransitions());

      parent = parent.parent!;
    }
  }
  return transitionDefinitions;
}