onJoin<E extends Event, TOSTATE extends State> method

void onJoin<E extends Event, TOSTATE extends State>({
  1. GuardCondition<E> condition = noopGuardCondition,
  2. SideEffect<Event>? sideEffect,
})

Adds an event to the set of events that must be triggered to leave the ownercoregion. Every onJoin in a coregion must target the same external state.

Implementation

void onJoin<E extends Event, TOSTATE extends State>(
    {GuardCondition<E> condition = noopGuardCondition,
    SideEffect? sideEffect}) {
  final onTransition = JoinTransitionDefinition<S, E, TOSTATE>(
      _stateDefinition, condition, sideEffect);

  _stateDefinition.addTransition<E>(onTransition);
}