execute method

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

Executes the audio tutorial step.

Plays the audio file and calls onFinished when playback is complete.

Implementation

@override
Future<void> execute(TutorialBloc? tutorialBloc) async {
  final player = AudioPlayer();
  Duration? duration = await player.setAsset(assetPath);
  if (duration == null) {
    player.dispose();
    onFinished(tutorialBloc);
    return;
  }
  player.play();
  // TODO Get correct Duration value from Audio Source
  await Future.delayed(const Duration(seconds: 2)).then((value) {
    player.dispose();
    onFinished(tutorialBloc);
  });
}