dispose method

void dispose()

Cancels the connectivity listener and disposes the socket entirely. Call init again to start a fresh connection afterwards.

Implementation

void dispose() {
  _connectivitySubscription?.cancel();
  _connectivitySubscription = null;
  _socket?.dispose();
  isConnected = false;
  isHandshakeComplete = false;
}