State<T> class

Implementers

Constructors

State(String? id, {String? description, Iterable<Transition<T>> transitions = const [], Action<T>? onEntry, Action<T>? onExit, bool isFinal = false, bool isParallel = false, Iterable<State<T>> substates = const [], Transition<T>? initialTransition})
Creates a new State

Properties

containsHistoryState bool
Are any of the immediate substates a history state?
no setter
depth int
How many layers down does this node live?
latefinal
description String?
final
hashCode int
The hash code for this object.
no setterinherited
id String?
Unique identifier within its container (optional)
final
initialStates Iterable<State<T>>
The states referenced by initialTransition.
no setter
initialTransition Transition<T>?
The transition to run first.
final
isAtomic bool
True if this has no substates (i.e. is a leaf node)
no setter
isCompound bool
True if this has at least one substate.
no setter
isFinal bool
Declares this to be a final state
final
isParallel bool
Declares this to be a "parallel" state (all children active/inactive together)
final
onEntry Action<T>?
Action to be performed when this state or container is entered
final
onExit Action<T>?
Action to be performed when this state or container is exited
final
order int
Index into its parent's substates
latefinal
parent State<T>?
This node's parent (assigned late)
latefinal
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
substateIDs Iterable<String>
Used by toString to show IDs of substates, not the substates themselves.
no setter
substates Iterable<State<T>>
States contained within this one
final
toIterable Iterable<State<T>>
Walks this subtree in depth-first order.
no setter
transitions Iterable<Transition<T>>
All transitions from this state.
final

Methods

ancestors({State<T>? upTo}) Iterable<State<T>>
Finds the ancestors of a state
descendsFrom(State<T> other) bool
Whether this state descends from another.
enter(T? context, [EngineCallback? callback]) → void
Calls onEntry with the given context (if they are both non-null).
exit(T? context, [EngineCallback? callback]) → void
Calls onExit with the given context (if they are both non-null).
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
resolveTransitions(Map<String, State<T>> stateMap) → void
Used during root state resolution to add target states and source reference to all transitions.
toString() String
A string representation of this object.
override
transitionFor({String? event, Duration? elapsedTime, T? context, bool? ignoreContext = false}) Transition<T>?
Finds the first transition matching all the criteria, or returns null.

Operators

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

Static Methods

commonSubtree<T>(Iterable<State<T>> nodes) State<T>
The lowest node in the tree that encompasses all nodes.