platform_serial 0.1.0
platform_serial: ^0.1.0 copied to clipboard
Complete Flutter plugin for managing serial ports. Supports Windows, Linux, macOS, Android (OTG), and iOS (OTG) with a unified interface. Provides synchronous and asynchronous communication, support f [...]
📡 platform_serial #
🔌 Professional cross-platform serial communication plugin for Flutter with sync/async I/O, streaming, typed errors, and native bridge support.
✨ Features #
- Unified API (
SerialManager,SerialPort) across supported platforms - Binary and text communication (
read,readSync,readUntil,write,writeText) - Real-time streams (
dataStream,textStream,errorStream) - Typed error model (
SerialError,SerialErrorType) - Unit, integration and e2e tests
- Professional Copilot assets in
.github/(instructions, agents, skills, hooks, MCP, collections)
Platform Support #
| Platform | Implementation | Status |
|---|---|---|
| Windows | FFI (platform_serial.dll) |
✅ |
| macOS | FFI (DynamicLibrary.process) |
✅ |
| Linux | MethodChannel | ✅ |
| Android | MethodChannel | ✅ |
| iOS | MethodChannel | ✅ |
| Web | Not supported | ❌ |
Quick Start #
import 'package:platform_serial/platform_serial.dart';
final manager = SerialManager();
final ports = await manager.getAvailablePorts();
final port = await manager.openPort('COM3', baudRate: 115200, dataBits: 8);
await port.writeText('AT\r\n');
final response = await port.readUntil('\n');
await manager.closePort('COM3');
Example Application #
This repository includes a full professional example app in example/:
- serial port selection and refresh
- configurable serial parameters (baud rate, data bits, stop bits, parity, flow control, read/write timeout)
- open/close connection lifecycle
- bidirectional serial terminal (read + write)
- themed UI with color-coded terminal events
- splash screen with logo
- about dialog with copyright and licenses
- multilingual UI (EN, FR, PT, ES, IT, DE, NL, RU, EL, TR, AR, HE, ZH, JA, KO)
Run it:
cd example
flutter pub get
flutter run
Build, Lint and Test #
flutter pub get
flutter analyze
flutter test
Example app tests:
cd example
flutter test
License #
This project is licensed under the MIT License. See LICENSE.