nextStep method

void nextStep({
  1. required T tutorialId,
  2. String? route,
  3. Object? arguments,
  4. bool backToPreviousPage = false,
  5. BuildContext? context,
})

Advances to the next step or ends tutorial if last step.

Optional navigation:

  • route: Name of route to push
  • arguments: Route arguments
  • backToPreviousPage: Pop current route
  • context: Required for navigation if no custom navigator provided

Implementation

void nextStep({
  required T tutorialId,
  String? route,
  Object? arguments,
  bool backToPreviousPage = false,
  BuildContext? context,
}) {
  _validateTutorialId(tutorialId);

  if (isLastStep(tutorialId)) {
    endTutorial(tutorialId);
  } else {
    _currentSteps[tutorialId] = getCurrentStep(tutorialId) + 1;
  }

  _handleNavigation(
    route: route,
    arguments: arguments,
    back: backToPreviousPage,
    context: context,
  );
  notifyListeners();
}