onEnterFromChannel<P> method
void
onEnterFromChannel<P>(
- Channel<
P> channel, - void build(
- TransitionHandlerBuilder<
D, P>
- TransitionHandlerBuilder<
override
Describes how transition to this state through channel should be handled.
The build function is called with a TransitionHandlerBuilder that can be used
to describe the behavior of the entry transition.
Implementation
@override
void onEnterFromChannel<P>(
Channel<P> channel,
void Function(TransitionHandlerBuilder<D, P>) build,
) {
var builder = TransitionHandlerBuilder<D, P>._(
key,
_log,
(transCtx) {
try {
return transCtx.payloadOrThrow<P>();
} catch (e) {
throw StateError('Failed to enter channel '
'${channel.label != null ? '"${channel.label}" ' : ''}'
'to state ${channel.to}: $e');
}
},
);
build(builder);
_onEnter = builder._descriptor;
}