nextInList method

Step? nextInList(
  1. Step? step
)

Implementation

Step? nextInList(Step? step) {
  final currentIndex = task.steps.indexWhere(
      (element) => element.stepIdentifier == step?.stepIdentifier);
  // end survey if already completed via CompletionStep
  if (step is CompletionStep) {
    return null;
  }
  return (currentIndex + 1 > task.steps.length - 1)
      ? null
      : task.steps[currentIndex + 1];
}