dart_serial_port 0.0.3 dart_serial_port: ^0.0.3 copied to clipboard
Serial Port for Dart (FFI bindings to libserialport, a minimal C-library created by the sigrok).
Serial Port for Dart #
Serial Port for Dart is based on libserialport, which is a minimal C-library created by the sigrok projects, and released under the LGPL3+ license.
Usage #
import 'package:dart_serial_port/dart_serial_port.dart';
final name = SerialPort.availablePorts.first;
final port = SerialPort(name);
if (!port.openReadWrite()) {
print('${SerialPort.lastErrorMessage} ${SerialPort.lastErrorCode}');
exit(-1);
}
port.write(/* ... */);
final reader = SerialPortReader(port);
reader.stream.listen((data) {
print('received: $data');
});
To use this package, add dart_serial_port
as a dependency in your pubspec.yaml file.