serial
0.0.7+1, released 2 years ago by pwa.ir
Wrapper for the Web Serial API to use serial ports in Flutter web.
What it does
Provides a thin Dart wrapper around window.navigator.serial so you can request, open, read from, and write to serial ports from Flutter web. It exposes the native streaming APIs without requiring custom JavaScript.
AI-written summary of version 0.0.7+1, based on the package's README and metadata. Report an inaccuracy
Use it when
- You need to communicate with serial devices from a Flutter web app
- You want a zero‑JS, out‑of‑the‑box solution for the Web Serial API
Skip it when
- Your app targets mobile or desktop platforms
- You require advanced serial features not exposed by the browser API
- You need cross‑platform serial support
Strengths
- Simple, no extra JavaScript needed
- Uses native streaming APIs for read/write
- Works in secure‑context browsers
Weaknesses
- Web‑only, no support for other platforms
- Limited to the capabilities of the browser's Serial API
- Minimal documentation
Setup
- Kind
- Pure Dart
- Effort
- Low
- Code generation
- No
- Direct dependencies
- 1
Run the app over HTTPS (secure context) to access serial ports; no native setup required.
import 'dart:html';
import 'package:serial/serial.dart';
final port = await window.navigator.serial.requestPort();
await port.open(baudRate: 9600);
final writer = port.writable.writer;
await writer.ready;
await writer.write(Uint8List.fromList('Hello World.'.codeUnits));
await writer.ready;
await writer.close();Alternatives
Packages that do the same job and could replace serial.
- adb
A Dart wrapper for interacting with the Android Debug Bridge (adb).
77Compare - universal_web
Wrapper that allows importing web APIs in non-web environments
76Compare - zxcvbn
Dart port of Dropbox's zxcvbn password strength estimator library.
50Compare - actors
Thin wrapper around Dart Isolates implementing the Actor Model
44Compare
Works with
Packages commonly used together with serial: ones it builds on, ones built on it, and its own family.