libserialport 0.3.0+1 libserialport: ^0.3.0+1 copied to clipboard
Serial Port for Dart (FFI bindings to libserialport, a minimal C-library created by the sigrok).
import 'package:libserialport/libserialport.dart';
// ignore_for_file: avoid_print
void main() {
print('Available ports:');
var i = 0;
for (final name in SerialPort.availablePorts) {
final sp = SerialPort(name);
print('${++i}) $name');
print('\tDescription: ${sp.description}');
print('\tManufacturer: ${sp.manufacturer}');
print('\tSerial Number: ${sp.serialNumber}');
print('\tProduct ID: 0x${sp.productId!.toRadixString(16)}');
print('\tVendor ID: 0x${sp.vendorId!.toRadixString(16)}');
sp.dispose();
}
}