evaluateNextStep method

Step? evaluateNextStep(
  1. Step? step,
  2. ConditionalNavigationRule rule,
  3. QuestionResult? questionResult
)

Implementation

Step? evaluateNextStep(Step? step, ConditionalNavigationRule rule,
    QuestionResult? questionResult) {
  if (questionResult == null) {
    return nextInList(step);
  }
  final result = questionResult.result;
  if (result == null) {
    return nextInList(step);
  }
  final nextStepIdentifier =
      rule.resultToStepIdentifierMapper(questionResult.valueIdentifier);
  if (nextStepIdentifier == null) {
    return nextInList(step);
  }
  return task.steps
      .firstWhere((element) => element.stepIdentifier == nextStepIdentifier);
}