evaluateNextStep method
Step?
evaluateNextStep(
- Step? step,
- ConditionalNavigationRule rule,
- 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);
}