stop method

Future<void> stop()

Stops the audio that is currently playing.

The position is going to be reset and you will no longer be able to resume from the last point.

Implementation

Future<void> stop() async {
  desiredState = PlayerState.stopped;
  await creatingCompleter.future;
  if (desiredState == PlayerState.stopped) {
    await _platform.stop(playerId);
    state = PlayerState.stopped;
    await _positionUpdater?.stopAndUpdate();
  }
}