Skip to content
pubscout

serial_port_win32

3.0.0, released 3 months ago by an unverified publisher

A SerialPort library using win32 API for connecting real devices via serial port on Windows.

$ flutter pub add serial_port_win32
Source repository

What it does

Provides an interface to list available COM ports, open serial connections with specific configurations like baud rate and stop bits, and perform read and write operations using the Win32 API.

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

Use it when

  • You need to communicate with hardware connected via a serial port on Windows.
  • You are building a desktop application targeting Windows that talks to microcontrollers, sensors, or serial devices.

Skip it when

  • You need cross-platform serial port support (this package only supports Windows).
  • You require high-level reactive streams for continuous reading without imperative buffer management.

Strengths

  • Allows querying detailed port metadata including friendly names, hardware IDs, and manufacturer names.
  • Provides flexible read options including timeout-based reads, exact size reads, and delimiter reads.

Weaknesses

  • Platform support is strictly limited to Windows.
  • Port instances use a singleton pattern, requiring care when managing multiple connections or instances.

Setup

Kind
FFI (native library)
Effort
Low
Code generation
No
Direct dependencies
3

Requires Windows. Only supports Windows platform.

import 'package:serial_port_win32/src/serial_port.dart';

void main() {
  var ports = SerialPort.getAvailablePorts();
  print(ports);
  if (ports.isNotEmpty) {
    var port = SerialPort(ports[0]);
    port.BaudRate = CBR_115200;
    port.StopBits = ONESTOPBIT;
    port.close();
  }
}

Alternatives

Packages that do the same job and could replace serial_port_win32.

Works with

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