disconnect method

Future<void> disconnect()

Function to leave a room

Implementation

Future<void> disconnect() async {
  await myDataRef.remove();
  // if (players.isEmpty) {
  //   await ref!.remove();
  // } else
  if (adminId == gameManager.username) {
    await ref!.child("admin").set(players.first);
  }
}