sendDatagram function

void sendDatagram(
  1. DgramSocket socket,
  2. Uint8List bytes,
  3. String address,
  4. int port,
)

Sends bytes as a single UDP datagram to address:port.

Returns immediately; the socket's write callback reports completion via its JSFunction argument, which callers may ignore for fire-and- forget semantics.

Implementation

void sendDatagram(
  DgramSocket socket,
  Uint8List bytes,
  String address,
  int port,
) {
  socket.send(bytes.toJS, port.toJS, address.toJS);
}