leaveRoom method

Future<int?> leaveRoom()

@detail api @author luomingkang @brief Leaves the game room.
The user calls this method to leave the room, end the call process, and release all call-related resources.
@return - 0: Success. If the user is a host: - The other participants receive onUserLeave{@link #IRTCRoomEventHandler#onUserLeave} callback. - The publishing streams stop and the other participants receive notifications of the stream states via onAudioPublishStateChanged{@link #IRTCRoomEventHandler#onAudioPublishStateChanged} callback. - < 0 : Fail. See ReturnStatus{@link #ReturnStatus} for more details @note This method is an asynchronous operation, and the call returns without actually exiting the room. After you actually exit the room, you will receive a callback notification from onRoomStateChanged{@link #IRTCRoomEventHandler#onRoomStateChanged} locally. If the engine is destroyed immediately after this method is called, the SDK will not be able to trigger the onRoomStateChanged{@link #IRTCRoomEventHandler#onRoomStateChanged} callback.

Implementation

Future<int?> leaveRoom() async {
  $a() => ($instance as $p_a.RTCRoom).leaveRoom();
  $i() => ($instance as $p_i.ByteRTCRoom).leaveRoom();

  if (Platform.isAndroid) {
    return $a();
  } else if (Platform.isIOS) {
    return $i();
  } else {
    throw UnsupportedError(
        'Not Support Platform ${Platform.operatingSystem}');
  }
}