removePlayer method

Future<void> removePlayer({
  1. required String player_id,
})

Implementation

Future<void> removePlayer({
  required String player_id,
}) async {
  try {
    for (var element in players) {
      if (element.player_id == player_id) {
        try {
          await element.stop();
          await element.dispose();
        } catch (e) {}
      }
    }
    players.removeWhere((element) => element.player_id == player_id);
  } catch (e) {}
  return;
}