FinalDataState<D> constructor

FinalDataState<D>(
  1. DataStateKey<D> key,
  2. InitialData<D> initialData, {
  3. TransitionHandler? onEnter,
  4. StateDataCodec<D>? codec,
})

Constructs a final data state, identified by key.

When the data state is entered, initialData will be used to determine the initial value for the associated state data.

The behavior of the state when it is entered can be customized by providing an onEnter function.

Implementation

factory FinalDataState(
  DataStateKey<D> key,
  InitialData<D> initialData, {
  TransitionHandler? onEnter,
  StateDataCodec<D>? codec,
}) =>
    FinalDataState._((parent) {
      return LeafNodeInfo(
        key,
        (_) => DelegatingDataTreeState<D>(initialData.call, onEnter: onEnter),
        parent: parent,
        isFinalState: true,
        dataCodec: codec,
      );
    });