writeBytes method

  1. @override
Future<void> writeBytes({
  1. required int handleId,
  2. required Uint8List data,
  3. required int timeoutMs,
})
override

Writes data via libusb_bulk_transfer on the bulk-OUT endpoint associated with the handle. The handle is the UsbOpenResult.platformHandle returned by openForFfi.

Implementation

@override
Future<void> writeBytes({
  required int handleId,
  required Uint8List data,
  required int timeoutMs,
}) async {
  if (writeError != null) throw writeError!;
  final h = _handles[handleId];
  if (h == null) throw StateError('Invalid handle $handleId');
  h.written.add(Uint8List.fromList(data));
}