StateTree constructor
StateTree(
- InitialChild initialChild, {
- required List<
StateConfig> childStates, - List<
FinalStateConfig> finalStates = const [], - String? logName,
Constructs a state tree that is is composed of the states in the list of childStates
, and
starts in the state identified by the initialChild
.
The state tree has an implicit root state, identified by defaultRootKey. This state has no associated behavior, and it is typically safe to ignore its presence.
A list of finalStates
can be provided. Final states are children of the root state, and if a
final state is entered, further message processing or state transitions will not occur, and
the state tree can be considered complete.
Implementation
factory StateTree(
InitialChild initialChild, {
required List<StateConfig> childStates,
List<FinalStateConfig> finalStates = const [],
String? logName,
}) {
return StateTree._(_createRoot(
rootKey: defaultRootKey,
createState: (_) => DelegatingTreeState(),
initialChild: initialChild,
children: childStates,
finalStates: finalStates,
codec: null,
filters: null,
logName: logName,
));
}