close method

Future<void> close({
  1. bool? keepFocus,
})

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.

If there is no more Player open and the parameter keepFocus is not set then the focus is abandoned

example:

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

Implementation

Future<void> close({
  bool? keepFocus,
}) async {
  await _lock.synchronized(() async {
    await _close(keepFocus: keepFocus);
  });
}