readBytes method

Uint8List readBytes([
  1. int? count
])

Reads bytes from the port. If count is provided, only reads that number of bytes.

Implementation

Uint8List readBytes([int? count]) {
  try {
    return _port.read(count ?? _port.bytesAvailable);
  } catch (error) {
    logger.error("Could not read from serial port $portName:\n  $error");
    return Uint8List(0);
  }
}