onEnterWithData<D> abstract method

void onEnterWithData<D>(
  1. void handler(
    1. TransitionHandlerBuilderWithData<D>
    )
)
inherited

Describes how transitions to this state should be handled.

This method can be used when the entry handler requires access to state data of an ancestor state.

 // Root state carrying BugData instance
 var b = StateTreeBuilder.withDataRoot<BugData>(
   States.root,
   InitialData.value(BugData()..title = 'New Bug'),
   emptyDataState,
   InitialChild.key(States.open),
 );

 b.state(States.deferred, (b) {
   // When  deferred state is entered, update the BugData insance of the parent state
   b.onEnterWithData<BugData>((b) => b.updateData(
     (_, data) => data..assignee = null,
     label: 'clear assignee',
   ));
 }, parent: States.root);

The build function is called with a TransitionHandlerBuilderWithData that can be used to describe the behavior of the entry transition.

Implementation

void onEnterWithData<D>(void Function(TransitionHandlerBuilderWithData<D>) handler);