Abstract contract for the serial port interface.
- Implementers
Properties
- config → SerialConfig
-
Current port configuration.
no setter
-
dataStream
→ Stream<
Uint8List> -
Stream of received binary data.
no setter
-
errorStream
→ Stream<
SerialError> -
Stream of errors.
no setter
- hashCode → int
-
The hash code for this object.
no setterinherited
- isOpen → bool
-
Whether the port is open.
no setter
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
-
textStream
→ Stream<
String> -
Stream of received text data.
no setter
Methods
-
bytesAvailable(
) → Future< int> - Gets the number of bytes available in the input buffer.
-
close(
) → Future< void> - Closes the serial port.
-
flush(
) → Future< void> - Flushes the output buffer.
-
getControlSignals(
) → Future< SerialControlSignals> - Gets the current modem control/status signal states.
-
getCts(
) → Future< bool> - Returns whether the CTS input line is currently asserted.
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
open(
SerialConfig config) → Future< void> - Opens the serial port with the specified configuration.
-
read(
int length, {Duration? timeout}) → Future< Uint8List> - Reads up to the specified number of bytes. Returns available data or waits until timeout.
-
readSync(
{Duration? timeout}) → Future< Uint8List> - Reads data synchronously with an optional timeout. Throws SerialError if the port is not open or on timeout.
-
readTextSync(
{Duration? timeout}) → Future< String> - Reads text data synchronously with an optional timeout. Throws SerialError if the port is not open or on timeout.
-
readUntil(
String terminator, {Duration? timeout}) → Future< String> - Reads until the terminator string is found. Throws SerialError if it is not found within the timeout.
-
resetBuffers(
) → Future< void> - Resets the input and output buffers.
-
setDtr(
bool enabled) → Future< void> - Sets the DTR modem control line.
-
setRts(
bool enabled) → Future< void> - Sets the RTS modem control line.
-
toString(
) → String -
A string representation of this object.
inherited
-
write(
Uint8List data, {Duration? timeout}) → Future< int> - Writes binary data to the port. Returns the number of bytes written.
-
writeText(
String data, {Duration? timeout}) → Future< int> - Writes text data to the port. Returns the number of bytes written.
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited