handleMessage method

Cmd? handleMessage(
  1. Msg msg
)

Processes a Msg produced by the active timeline step.

Returns a Cmd when the active step schedules more work or when the timeline advances into the next step.

Implementation

Cmd? handleMessage(Msg msg) {
  if (!_isRunning || _activeStep == null) {
    return null;
  }

  final next = _activeStep!.handleMessage(msg);
  if (!_activeStep!.isComplete) {
    return next;
  }

  onStepComplete?.call(
    _currentStepIndex,
    _steps[_currentStepIndex],
    _direction,
  );

  _currentStepIndex += 1;
  final advance = _startCurrentStep();
  return _mergeSequential(next, advance);
}