nextStep method

  1. @override
Step? nextStep({
  1. required Step step,
  2. QuestionResult? questionResult,
})
override

Implementation

@override
Step? nextStep({required Step step, QuestionResult? questionResult}) {
  record(step);
  final navigableTask = task as NavigableTask;
  NavigationRule? rule =
      navigableTask.getRuleByStepIdentifier(step.stepIdentifier);
  if (rule == null) {
    return nextInList(step);
  }
  switch (rule.runtimeType) {
    case DirectNavigationRule:
      return task.steps.firstWhere((element) =>
          element.stepIdentifier ==
          (rule as DirectNavigationRule).destinationStepIdentifier);
    case ConditionalNavigationRule:
      return evaluateNextStep(
          step, rule as ConditionalNavigationRule, questionResult);
  }
  return nextInList(step);
}