write method

void write(
  1. Object? object
)

Converts object to a String by invoking Object.toString and sends the encoding of the result to the socket.

Parameters:

  • object: The object to write to the socket.

Returns: A Future that resolves to void.

Implementation

void write(Object? object) {
  // Don't write null.
  if (object == null) return;

  // Write the data to the socket.
  List<int> data = utf8.encode(object.toString());
  if (sslEnabled) {
    _secureSocksSocket.add(data);
  } else {
    _socksSocket.add(data);
  }
}