StateTreeBuilder constructor

StateTreeBuilder({
  1. required StateKey initialState,
  2. String? label,
  3. String? logName,
})

Creates a StateTreeBuilder that will build a state tree that starts in the state identified by initialState.

The state tree has an implicit root state, identified by StateTreeBuilder.defaultRootKey. This state has no associated behavior, and it is typically safe to ignore its presence.

The builder can optionally be given a label for diagnostic purposes, and a logName which identifies the builder in log output. If logName is unspecifed, label will be used instead.

Implementation

factory StateTreeBuilder({required StateKey initialState, String? label, String? logName}) {
  var b = StateTreeBuilder._(defaultRootKey, label, logName);
  b.state(defaultRootKey, emptyState, initialChild: InitialChild(initialState));
  return b;
}