Skip to main content Link Menu Expand (external link) Document Search Copy Copied
stopPlayer method - FlutterSoundPlayer class - player library - Dart API
menu
stopPlayer

stopPlayer method

Future<void> stopPlayer()

Stop a player.


This verb never throws any exception. It is safe to call it everywhere, for example when the App is not sure of the current Audio State and wants to recover a clean reset state.

Return

A future completed when the stopPlayer function is done

Example

        await myPlayer.stopPlayer();
        if (_playerSubscription != null)
        {
                _playerSubscription.cancel();
                _playerSubscription = null;
        }

See also


Implementation

Future<void> stopPlayer() async {
  await _lock.synchronized(() async {
    await _stopPlayer();
  });
}
flutter_sound 9.25.3