StateMachine class

A runtime state machine that manages state changes and transitions.

Created from a StateMachineDef via StateMachine.fromDef. Tracks the current state, handles events via send, manages blend transitions via update, and notifies listeners on state changes.

Constructors

StateMachine.fromDef(StateMachineDef def)
Creates a runtime state machine from a StateMachineDef.

Properties

activeTransition → ActiveTransition?
The active blend transition, or null if not transitioning.
no setter
blendInfo → BlendInfo?
Extracts BlendInfo if there is an active transition between two states that both have animations. Returns null otherwise.
no setter
currentState → String
The name of the current state.
no setter
currentStateDef → StateDef?
The StateDef for the current state, or null if not found.
no setter
hashCode → int
The hash code for this object.
no setterinherited
initialState → String
The initial state this machine started in.
final
name → String
The name of this state machine (must be unique, camelCase).
final
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited
states → Map<String, StateDef>
Unmodifiable map of state name to StateDef.
final
transitions → List<TransitionDef>
Unmodifiable list of transition definitions.
final

Methods

addListener(void listener(String from, String to)) → void
Registers a listener that is called whenever the state changes.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
notifyAnimationComplete() → void
Notifies the state machine that the current animation has completed.
removeListener(void listener(String from, String to)) → void
Removes a previously registered listener.
send(String event) → bool
Sends an event to the state machine.
toString() → String
A string representation of this object.
inherited
update(Duration delta) → void
Advances any active blend transition by delta.

Operators

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