nextStep method

Future<void> nextStep()

Moves to the next step in the survey and completes the survey if it's the last step.

Implementation

Future<void> nextStep() async {
  if (currentStepIndex < steps.length - 1) {
    // final currentStep = steps[currentStepIndex];
    await handleStepCallbacks(currentStep);
    currentStepIndex++;
    await _nextPage();
    notifyListeners();
  } else {
    await handleStepCallbacks(currentStep);
    completeSurvey();
  }

  currentStep.onInit?.call(currentStep);
  if (currentStep.stepType == SurveyStepType.preparation) {
    nextStep();
  }
}