InitialChild class
Describes the initial child state of a parent state.
Because the current state in a tree state machine is always a leaf state, when a parent state is entered, one of its children must immediately be entered as well. The specific child state that is entered is called the initial child of the parent state, and is determined by a GetInitialChild function that is run on entering the parent state.
InitialChild allows configuration of GetInitialChild as a state is being defined.
var parentState = StateKey('p');
var childState1 = StateKey('c1');
var childState2 = StateKey('c2');
var builder = StateTreeBuilder(initialState: parentState);
// Enter childState2 when parentState is entered
builder.state(parentState, emptyState, initialChild: InitialChild(childState2));
builder.state(childState1, emptyState, parent: parentState);
builder.state(childState2, emptyState, parent: parentState);
Constructors
- InitialChild(StateKey key)
-
Constructs an InitialChild indicating that the state identified by
keyshould be entered.factory - InitialChild.run(GetInitialChild getInitialChild)
-
Constructs an InitialChild that will run the
getInitialChildfunction when the state is entered in order to determine the initial child,factory
Properties
- hashCode → int
-
The hash code for this object.
no setterinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
call(
TransitionContext transCtx) → StateKey - Returns the key of the child state that should be entered.
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited