finalState method

void finalState(
  1. StateKey stateKey,
  2. void build(
    1. EnterStateBuilder<void> builder
    ), {
  3. StateKey? parent,
})

Adds to the state tree a description of a final state, identified by stateKey. The behavior of the state is configured by the build callback.

A final state is a terminal state for a state tree. Once a final state has been entered, no further messsage processing or state transitions will occur.

A final state never has any child states, and is always a child of the root state.

Implementation

void finalState(
  StateKey stateKey,
  void Function(EnterStateBuilder<void> builder) build, {
  StateKey? parent,
}) {
  var builder = StateBuilder<void>._(
    stateKey,
    InitialData._empty,
    _log,
    parent,
    null,
    isFinal: true,
  );
  build(builder);
  _addState(builder);
}