close method

void close()

Closes the UDP instance and the underlying socket.

Implementation

void close() {
  _closed = true;
  _socket?.close();
  _socket = null;
  _socketBroadcastStream = null;
  _streamController?.close();
  _streamSubscriptions.forEach((streamSubscription) {
    streamSubscription.cancel();
  });
  _streamSubscriptions.clear();
}