Skip to content
pubscout

flserial

0.7.3, released 4 months ago by glpro.pl

A high-performance, asynchronous serial port plugin for Flutter using Dart FFI and Native Assets.

$ flutter pub add flserial
Source repository

What it does

It enables communication with serial and RS232 devices across Windows, Linux, macOS, Android, and Web. It uses a native C++ worker thread for async I/O and provides a reactive stream for incoming data and device events.

AI-written summary of version 0.7.3, based on the package's README and metadata. Report an inaccuracy

Use it when

  • You need to communicate with RS232, USB-serial adapters, or hardware COM ports from Flutter.
  • You require cross-platform serial port support including desktop, Android, and web browsers.

Skip it when

  • You are targeting Firefox or Safari on the web, as they do not support the Web Serial API.
  • You only need high-level network communication (such as HTTP or WebSockets).

Strengths

  • Asynchronous I/O via native C++ worker thread keeps the UI thread free.
  • Reactive stream interface for incoming data and events.
  • Supports Native Assets on desktop and Android USB Host API without manual library copying.

Weaknesses

  • Modem control lines and some configurations are not supported on the web platform.
  • Android requires specific USB host permissions configured in the manifest.

Setup

Kind
Plugin (native code)
Effort
Medium
Code generation
No
Direct dependencies
4

For Android, add the uses-feature tag for usb.host in AndroidManifest.xml. On the web, works in Chrome and Edge 89+.

import 'dart:typed_data';
import 'package:flserial/flserial.dart';

final serial = FlSerial();

serial.events.listen((event) {
  if (event.type == SerialEventType.data) {
    print('Received: ${String.fromCharCodes(event.data as Uint8List)}');
  }
});

final ports = await FlSerial.availablePorts();
final ok = await serial.open(ports.first.path, SerialConfig(baudRate: 115200));

Alternatives

Packages that do the same job and could replace flserial.

Works with

Packages commonly used together with flserial: ones it builds on, ones built on it, and its own family.