dispose method Null safety

void dispose()

Implementation

void dispose() {
  if (_sockets != null) {
    for (var socket in sockets) {
      socket.close();
    }
    _sockets?.clear();
    sockets = null;
  }
  if (_httpClient != null) {
    httpClient.close();
    _httpClient = null;
  }
  _isDisposed = true;
}