TutorialBloc constructor

TutorialBloc(
  1. TutorialRunner _tutorial
)

Implementation

TutorialBloc(this._tutorial) : super(const TutorialState.idle()) {
  on<TutorialStartEvent>((event, emit) async {
    await progressTutorial(event, emit);
  });
  on<TutorialNextStepEvent>((event, emit) async {
    await progressTutorial(event, emit);
  });
  on<TutorialReplayStepEvent>((event, emit) async {
    TutorialStep? currentStep = state.currentTutorialStep;
    TutorialStep? replayStep = event.replayStep;

    if (replayStep != null) {
      if (currentStep != null) {
        _tutorial.registerStepForReplay(currentStep);
      }
      replayStep.execute(this);
      emit(TutorialState.running(state._currentTutorialIndex, replayStep));
    }
  });
}