getStepBeforeStep method

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

Returns the step that precedes the specified step, if there is one. If the specified step is null then it returns the last step.

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

Implementation

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

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

  if (nextIndex >= 0) {
    return _steps[nextIndex];
  }

  return null;
}