onMessageWithData<M, D2> method
Describes how messages of type M should be handled by this state, when provided ancestor
state data of type D2.
This method can be used when the message handler for a state requires access to state data from one of its ancestor states.
The build function is called with a TransitionHandlerBuilder that can be used to
describe the behavior of the exit transition.
Implementation
void onMessageWithData<M, D2>(void Function(MessageHandlerBuilder<M, D, D2> b) build) {
var builder = MessageHandlerBuilder<M, D, D2>(
key,
(msgCtx) => msgCtx.dataValueOrThrow<D2>(),
_log,
null,
);
build(builder);
if (builder.descriptor != null) {
_messageHandlerMap[M] = builder.descriptor!;
}
}