getConnectionState method Null safety

ConnectionState getConnectionState()

Returns ConnectionState.

Implementation

ConnectionState getConnectionState() {
  final socket = _int.webSocket;
  if (_int.state.connecting || _int.state.reconnecting) {
    return ConnectionState.connecting;
  } else if (socket != null) {
    return socket.connectionState;
  }
  return ConnectionState.closed;
}