execute method

  1. @override
Future<void> execute(
  1. TutorialBloc? tutorialBloc
)
override

Executes the waiting step.

This method waits for the condition to be met within the specified timeout. If the condition is met, it calls onFinished. If not, it triggers a replay if replayStep is set, or logs a warning in debug mode.

Implementation

@override
Future<void> execute(TutorialBloc? tutorialBloc) async {
  if (await performConditionCheck()) {
    onFinished(tutorialBloc);
  } else {
    // Duration exceeded and condition is not met, trigger replay if set
    if (replayStep != null) {
      TutorialBloc.triggerReplay(tutorialBloc, replayStep);
    } else {
      if (kDebugMode) {
        print("TUTORIAL WARNING: "
            "TutorialStepWithWaiting duration exceeded without replay, tutorial cannot be finished.");
      }
    }
  }
}