# switchRoom method Null safety

Future<void> switchRoom(

1. TRTCSwitchRoomConfig config

)

Switch room

After this API is called, the original room will be exited, and audio/video data sending in the original room and audio/video playback to all remote users will be stopped, but the local video preview will be continued. After new room entry succeeds, the original audio/video data sending status will be automatically restored.

The API call result will be called back through `onSwitchRoom(errCode, errMsg)`.

## Implementation

    Future<void> switchRoom(TRTCSwitchRoomConfig config) {
      return _channel.invokeMethod('switchRoom', {
        "config": jsonEncode(config),
      });
    }