StateTreeBuilder.withRoot constructor
StateTreeBuilder.withRoot(
- StateKey rootState,
- void build(
- StateBuilder builder
- InitialChild initialChild
Creates a StateTreeBuilder with a predefined root state.
The root state is identified by rootState, and has an initial child state identified by
initialChild. The behavior of the state is configured by calling methods on the
StateBuilder that is provided to the build callback.
Any states without an explicit parent that are added to this builder will implicitly be considered a child of this root state.
Implementation
factory StateTreeBuilder.withRoot(
StateKey rootState,
void Function(StateBuilder builder) build,
InitialChild initialChild,
) {
var b = StateTreeBuilder._(rootState);
b.state(rootState, build, initialChild: initialChild);
return b;
}