finalDataState<D> method

void finalDataState<D>(
  1. StateKey stateKey,
  2. InitialData<D> initialData,
  3. void build(
    1. EnterStateBuilder<D> builder
    ), {
  4. StateKey? parent,
  5. StateDataCodec? codec,
})

Adds to the state tree a description of a final data state, identified by stateKey and carrying a value of type D. 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 finalDataState<D>(
  StateKey stateKey,
  InitialData<D> initialData,
  void Function(EnterStateBuilder<D> builder) build, {
  StateKey? parent,
  StateDataCodec? codec,
}) {
  var builder = StateBuilder<D>._(
    stateKey,
    initialData,
    _log,
    parent,
    null,
    isFinal: true,
    codec: codec,
  );
  build(builder);
  _addState(builder);
}