readBytes method
- 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("Serial device on $portName has suddenly disconnected");
stopListening();
_port.dispose(isSafe: false);
return Uint8List(0);
}
}