dart_serial_port 0.1.0-nullsafety.0 copy "dart_serial_port: ^0.1.0-nullsafety.0" to clipboard
dart_serial_port: ^0.1.0-nullsafety.0 copied to clipboard

discontinuedreplaced by: libserialport
outdated

Serial Port for Dart (FFI bindings to libserialport, a minimal C-library created by the sigrok).

Serial Port for Dart #

pub CI style: lint license: LGPL3+

TIP: See also flutter_serial_port for automatic building and deploying of libserialport.

dart_serial_port is based on libserialport, which is a minimal C-library created by the sigrok project, and released under the LGPL3+ license.

Supported platforms:

  • Linux
  • macOS
  • Windows
  • Android

dart_serial_port uses dart:ffi to call libserialport's C APIs, which implies that libserialport must be bundled to or deployed with the host application. It can be tedious to build and deploy libserialport on all target platforms, but in case you are building a Flutter app instead of a pure Dart app, there is a ready-made drop-in solution called flutter_serial_port that utilizes Flutter's build system to build and deploy libserialport on all supported platforms:

Usage #

import 'package:dart_serial_port/dart_serial_port.dart';

final name = SerialPort.availablePorts.first;
final port = SerialPort(name);
if (!port.openReadWrite()) {
  print(SerialPort.lastError);
  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.

18
likes
0
pub points
54%
popularity

Publisher

unverified uploader

Serial Port for Dart (FFI bindings to libserialport, a minimal C-library created by the sigrok).

Repository (GitHub)
View/report issues

License

unknown (LICENSE)

Dependencies

ffi

More

Packages that depend on dart_serial_port