send method Null safety

void send(
  1. dynamic data
)

Implementation

void send(dynamic data) {
  if (connectionStatus == ConnectionStatus.closed) {
    connect();
  }
  if (socket != null && socket!.readyState == WebSocket.OPEN) {
    socket!.send(data);
  } else {
    Get.log('WebSocket not connected, message $data not sent');
  }
}