SerialPortReader class Null safety

Asynchronous serial port reader.

Provides a stream that can be listened to asynchronously to receive data whenever available.

The stream will attempt to open a given port for reading. If the stream fails to open the port, it will emit SerialPortError. If the port is successfully opened, the stream will begin emitting Uint8List data events.

Note: The reader must be closed using close() when done with reading.

Constructors

SerialPortReader(SerialPort port, {int? timeout})
Creates a reader for the port. Optional timeout parameter can be provided to specify a time im milliseconds between attempts to read after a failure to open the port for reading. If not given, timeout defaults to 500ms.
factory

Properties

hashCode int
The hash code for this object.
read-onlyinherited
port SerialPort
Gets the port the reader operates on.
read-only
runtimeType Type
A representation of the runtime type of the object.
read-onlyinherited
stream Stream<Uint8List>
Gets a stream of data.
read-only

Methods

close() → void
Closes the stream.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a non-existent method or property is accessed.
inherited
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited