nextState

fun nextState(currentState: State, event: EventType): Either<EventHandlingError, State>

Return

If there is a Transition from currentState on event, returns the State to which the Transition leads (Transition.toState).

Otherwise, returns an EventHandlingError.