handlePreviousQuestion method
void
handlePreviousQuestion()
Goes to the previous question in question_by_question mode.
If at the first question of the current step, goes to the last question of the previous step.
Implementation
void handlePreviousQuestion() {
final questions = currentDisplayedStep.displayableQuestions;
assert(questions.isNotEmpty, '🚩 Current step should have at least one question');
if (!isFirstStepQuestion) {
_currentQuestionIndex--;
} else if (_currentStepIndex > 0) {
handlePreviousStep();
final prevStepQuestions = currentDisplayedStep.displayableQuestions;
assert(prevStepQuestions.isNotEmpty, '🚩 Previous step should have at least one question');
_currentQuestionIndex = prevStepQuestions.length - 1;
} else {
debugPrint('Already at the very first question of the very first step.');
return;
}
computeDisplayableQuestions();
}