getStepAfterStep method

  1. @override
RPStep getStepAfterStep (RPStep step, RPTaskResult result)
override

Returns the step after a specified step if there's any. If the specified step is null then it returns the first step.

Returns null if step was the last one in the sequence.

Implementation

@override
RPStep getStepAfterStep(RPStep step, RPTaskResult result) {
  if (step == null) {
    return _steps.first;
  }

  int nextIndex = _steps.indexOf(step) + 1;

  if (nextIndex < _steps.length) {
    return _steps[nextIndex];
  }

  return null;
}