pollTransmit method

Uint8List? pollTransmit()

Bytes to write to the transport, or null when there are none.

Implementation

Uint8List? pollTransmit() {
  _alive();
  final bytes = _bindings.pollTransmit(_handle);
  if (bytes.ptr == nullptr || bytes.len == 0) {
    return null;
  }
  // copy before freeing: the returned list would otherwise view memory we are about to release
  final copy = Uint8List.fromList(bytes.ptr.asTypedList(bytes.len));
  _bindings.freeBytes(bytes);
  return copy;
}