Skip to content
pubscout

sunmi_scanner

0.0.8, released 3 months ago by francescodema.dev

Flutter plugin to control Sunmi Android barcode scanner via its native service.

WASM-ready
$ flutter pub add sunmi_scanner
Source repository

What it does

Provides a Dart API to bind to the Sunmi scanner service, listen to barcode scan events and connection status, and trigger scans programmatically. It wraps the Sunmi Android SDK for hardware barcode scanners.

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

Use it when

  • You need to use the built‑in barcode scanner on Sunmi Android devices
  • You require low‑level control over scanner service lifecycle
  • You prefer event‑driven (stream) handling of scan results

Skip it when

  • Your app must run on iOS or non‑Sunmi Android devices
  • You want a cross‑platform camera‑based scanner
  • You prefer a plug‑and‑play solution without manual service binding

Strengths

  • Direct access to Sunmi hardware features
  • Stream API for real‑time scan and status events
  • Allows manual control of service binding/unbinding

Weaknesses

  • Android‑only, Sunmi‑specific
  • Requires explicit bind/unbind calls
  • Limited to devices that support Sunmi SDK

Setup

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

Add the package, then call SunmiScanner.bindService() (optionally hide toasts) in initState and SunmiScanner.unbindService() in dispose. No extra Dart code generation needed, but the plugin works only on Android devices with Sunmi SDK.

import 'package:sunmi_scanner/sunmi_scanner.dart';

void initScanner() async {
  await SunmiScanner.bindService();
  SunmiScanner.onBarcodeScanned().listen((code) => print('Scanned: $code'));
  SunmiScanner.scan();
}

Alternatives

Packages that do the same job and could replace sunmi_scanner.

Works with

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