stop method

Future<void> stop()

Stops playing audio and releases decoders and other native platform resources needed to play audio. The current audio source state will be retained and playback can be resumed at a later point in time.

Use stop if the app is done playing audio for now but may need still want to resume playback later. Use dispose when the app is completely finished playing audio. Use pause instead if you would like to keep the decoders alive so that the app can quickly resume audio playback.

Implementation

Future<void> stop() async {
  if (_disposed) return;
  final future =
      _setPlatformActive(false)?.catchError((dynamic e) async => null);

  _playInterrupted = false;
  // Update local state immediately so that queries aren't surprised.
  _playingSubject.add(false);
  await future;
}