StateDefinition<S extends State> class

A StateDefinition represents a state defined in the statemachine builder.

Constructors

StateDefinition(Type stateType)

Properties

childStateDefinitions List<StateDefinition<State>>
List of State definitions for the set of immediate children of this state. The are in the same order as the builder declares them.
final
hashCode int
The hash code for this object.
no setterinherited
initialState Type?
The initial state if this is the parent of a nested set of states.
getter/setter pair
isAbstract bool
A state is an abstract state if it has any child states You cannot use an abstract state as an transition target.
no setter
isCoRegion bool
The state has concurrent children.
no setter
isLeaf bool
A state is a leaf state if it has no child states.
no setter
isTerminal bool
A state is a terminal state if it has no transitions and therefore we can never leave this state. We need to check any parent states as we inherit transitions from all our ancestors.
no setter
isVirtualRoot bool
no setter
nestedStateDefinitions List<StateDefinition<State>>
Returns a complete list of nested StateDefinitions below this state in the tree. i.e. every possible child/grandchild/... state.
no setter
onEnter OnEnter
callback used when we enter toState. Provides a default no-op implementation.
getter/setter pair
onEnterLabel String?
Optional label used when visualising the FSM.
getter/setter pair
onExit OnExit
callback used when we exiting this State. Provide provide a default no-op implementation.
getter/setter pair
onExitLabel String?
Optional label used when visualising the FSM.
getter/setter pair
pageBreak bool
If true then this state and all child states will be printed on a separate page.
getter/setter pair
parent StateDefinition<State>?
The parent of this state in the FSM tree.
no setter
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
statePath → StatePath
no setter
stateType Type
The Type of the State that this StateDefinition is for.
final

Methods

addTransition<E extends Event>(TransitionDefinition<E> transitionDefinition) → void
canTrigger(Type event) bool
default implementation.
findStateDefintion(Type? stateDefinitionType, {bool includeChildren = true}) StateDefinition<State>?
recursively searches through the list of nested StateDefinitions for a StateDefinition of type stateDefinitionType;
findTriggerableTransition<E extends Event>(Type fromState, E event) Future<TransitionDefinition<Event>?>
Returns the first transition that can be triggered for the given event from the given fromState.
getTransitions({bool includeInherited = true}) List<TransitionDefinition<Event>>
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.
isDecendentOf(StatePath potentialAncestor) bool
Returns true if we are a descendant of potentialAncestor
isDirectChild(Type state) bool
Returns true if the given state is a direct child of this StateDefinition.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
setParent<P extends State>(StateDefinition<P> parent) → void
toString() String
A string representation of this object.
override

Operators

operator ==(Object other) bool
The equality operator.
inherited