flutter_imin_lark_scanner 1.0.1
flutter_imin_lark_scanner: ^1.0.1 copied to clipboard
Flutter plugin for the built-in barcode scanner on iMIN Lark Android devices.
flutter_imin_lark_scanner #
A Flutter plugin for the built-in barcode scanner on iMIN Lark Android devices. It configures the iMIN scanner service for broadcast output and streams scan results to Dart.
Features #
- Configure the iMIN built-in scanner to deliver results via Android broadcast
- Stream barcode values to Dart through an
EventChannel - Example app included
Platform support #
| Platform | Support |
|---|---|
| Android | Yes — iMIN Lark devices with the built-in scanner service |
| iOS | Not supported |
This plugin communicates with the iMIN scanner API over Android intents and broadcasts. It is intended for iMIN Lark POS / handheld devices only.
Requirements #
- Flutter
>=3.3.0 - Dart
^3.10.7 - Android
minSdk 24 - iMIN device with the built-in scanner service installed
Installation #
Add the dependency to your pubspec.yaml:
dependencies:
flutter_imin_lark_scanner: ^0.0.1
Then run:
flutter pub get
Usage #
import 'dart:async';
import 'package:flutter/material.dart';
import 'package:flutter_imin_lark_scanner/flutter_imin_lark_scanner.dart';
class ScannerPage extends StatefulWidget {
const ScannerPage({super.key});
@override
State<ScannerPage> createState() => _ScannerPageState();
}
class _ScannerPageState extends State<ScannerPage> {
StreamSubscription<String>? _scanSubscription;
@override
void initState() {
super.initState();
final scanner = FlutterIminLarkScanner.instance;
unawaited(scanner.prepare());
_scanSubscription = scanner.barcodes.listen((barcode) {
debugPrint('Scanned: $barcode');
});
}
@override
void dispose() {
_scanSubscription?.cancel();
super.dispose();
}
@override
Widget build(BuildContext context) {
return const Scaffold(
body: Center(child: Text('Scan with the hardware trigger')),
);
}
}
Call prepare() once to configure broadcast output and register the native receiver. Listen to barcodes to receive scan results when the hardware scanner is used.
Example #
See the example/ app for a complete working demo.
cd example
flutter run
How it works #
On Android, the plugin:
- Sends a broadcast to configure the iMIN scanner for broadcast output
- Registers a receiver for
com.imin.scanner.api.RESULT_ACTION - Forwards decoded barcode values to Dart through an
EventChannel
Troubleshooting #
No scans received
- Confirm you are running on an iMIN Lark device with the built-in scanner service
- Call
prepare()before listening tobarcodes - Ensure no other app has exclusive control of the scanner
- Check logcat for the
FLUTTER_IMINtag
Contributing #
Issues and pull requests are welcome in the repository:
https://bitbucket.org/patel-apps/imin_lark_scanner_flutter
License #
See LICENSE.