flutter_industrial_scale 0.0.1 copy "flutter_industrial_scale: ^0.0.1" to clipboard
flutter_industrial_scale: ^0.0.1 copied to clipboard

Professional-grade weighing scale plugin. Connect via BLE, Bluetooth, USB, and Serial with built-in support for MT-SICS and CAS industrial protocols.

Flutter Industrial Scale #

A unified Flutter plugin for connecting and reading data from industrial and commercial weighing scales across multiple transport layers.

pub package License: MIT

Features #

  • Unified API: One interface to rule them all. Scan and connect to any scale, regardless of its connection type.
  • Multi-Transport Support:
    • Bluetooth Low Energy (BLE)
    • Bluetooth Classic
    • USB (via Serial-to-USB)
    • Serial (RS-232)
  • Intelligent Parsers: Built-in support for common industrial protocols:
    • MT-SICS: Mettler Toledo Standard Interface Command Set.
    • CAS: Common 22-byte protocol for retail and industrial scales.
    • ASCII: Generic text-based protocols.
  • Simulator Mode: A robust MockTransport that allows you to develop and test your UI without physical hardware.
  • Native Performance: Built with Dart FFI and a lightweight C/C++ bridge for minimal latency and high reliability.

Getting Started #

Installation #

Add this to your package's pubspec.yaml file:

dependencies:
  flutter_industrial_scale: ^0.0.1

Usage #

Scanning for Devices

import 'package:flutter_industrial_scale/flutter_industrial_scale.dart';

final scanner = IndustrialScale.instance.scan().listen((device) {
  print('Found device: ${device.name} (${device.type})');
});

Connecting and Reading Weight

final connection = await IndustrialScale.instance.connect(
  device, 
  parser: const MtSicsParser(),
);

connection.weightStream.listen((reading) {
  print('Weight: ${reading.value} ${reading.unit} (Stable: ${reading.isStable})');
});

Supported Protocols #

Protocol Description
MtSicsParser For high-end Mettler Toledo, OHAUS, and other SICS-compliant scales.
CasParser For CAS retail and floor scales using the 22-byte protocol.
AsciiParser A flexible parser for simple scales that output plain text weight values.

Platform Specific Setup #

Android #

Add the following permissions to your AndroidManifest.xml:

<uses-permission android:name="android.permission.BLUETOOTH_SCAN" />
<uses-permission android:name="android.permission.BLUETOOTH_CONNECT" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />

iOS #

Add this to your Info.plist:

<key>NSBluetoothAlwaysUsageDescription</key>
<string>This app needs Bluetooth to connect to industrial scales.</string>
<key>NSBluetoothPeripheralUsageDescription</key>
<string>This app needs Bluetooth to connect to industrial scales.</string>

Linux #

To access Serial ports, your user must be in the uucp or dialout group:

sudo usermod -a -G uucp $USER

Architecture #

graph TD
    A[IndustrialScale] --> B[BaseTransport]
    B --> C[BleTransport]
    B --> D[BluetoothTransport]
    B --> E[UsbTransport]
    B --> F[SerialTransport]
    A --> G[ScaleParser]
    G --> H[MtSicsParser]
    G --> I[CasParser]
    G --> J[AsciiParser]
    A --> K[ScaleConnection]
    K --> L[WeightReading]

Troubleshooting #

  • Permissions: Ensure Bluetooth and Location permissions are granted on Android/iOS.
  • Serial Ports: On Linux/Windows, ensure the correct driver is installed for USB-to-Serial converters (CH340/PL2303).
  • Protocol Mismatch: If you see raw data but no weight readings, ensure you are using the correct ScaleParser.

Contributing #

Contributions are welcome! If you find a bug or have a feature request, please open an issue.

License #

This project is licensed under the MIT License - see the LICENSE file for details.

1
likes
160
points
107
downloads

Documentation

API reference

Publisher

unverified uploader

Weekly Downloads

Professional-grade weighing scale plugin. Connect via BLE, Bluetooth, USB, and Serial with built-in support for MT-SICS and CAS industrial protocols.

Repository (GitHub)
View/report issues

Topics

#hardware #bluetooth #serial

License

MIT (license)

Dependencies

ffi, flutter, hooks, logging, meta, native_toolchain_c, plugin_platform_interface

More

Packages that depend on flutter_industrial_scale

Packages that implement flutter_industrial_scale