connect method Null safety

void connect()

this method is internally called by plugin to establish connection with provided websocket uri.

Implementation

void connect() {
  try {
    isConnected = true;
    channel = WebSocketChannel.connect(Uri.parse(url!), protocols: ['janus-protocol']);
  } catch (e) {
    print(e.toString());
    print('something went wrong');
    isConnected = false;
    dispose();
  }
  sink = channel!.sink;
  stream = channel!.stream.asBroadcastStream();
}