Flutter plugin that wraps Sunmi Android SDK for integrated hardware barcode scanners. Checked and working with Sunmi L2 device. All methods from SDK are supported.
Create instance of the plugin
var sunmiPlugin = SunmiBarcodePlugin();
Then somewhere in your code you can check if device has Sunmi integrated scanner
bool hasScanner = await sunmiPlugin.isScannerAvailable();
or find out exact scanner model number
int model = await sunmiPlugin.getScannerModel();
To get notified when barcode is scanned simply subscribe to stream
var barcodeSubscription = sunmiPlugin.onBarcodeScanned().listen((event) {
print(event);
});
To scan programatically you can use scan
and stop
methods.
If you don't have Sunmi device or just want to support more devices without implementing each SDK please check flutter_barcode_listener.