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

closePlayer method

Future<void> closePlayer()

Close an open session.


Must be called when finished with a Player, to release all the resources. It is safe to call this procedure at any time.

  • If the Player is not open, this verb will do nothing
  • If the Player is currently in play or pause mode, it will be stopped before.

example:

@override
void dispose()
{
        if (myPlayer != null)
        {
            myPlayer.closePlayer();
            myPlayer = null;
        }
        super.dispose();
}

Implementation

Future<void> closePlayer() async {
  await _lock.synchronized(() {
    return _closePlayer();
  });
}
flutter_sound 9.24.0