QR HID Reader
About
Implementation of the QR scanner listener that handles output as keyboard events.
This package allows working easily with any scanners that support the HID mode. In this mode, scanners work like a keyboard that provides a sequence of keypress events.
This also means that you can use a hardware keyboard with emulators to mock the behavior of the scanner for the test.
Description
To get scanned info you need to create one of available ScannerManager.
It has a property scanned
that is a publisher of any info which read by scanner.
Now available few types of the ScannerManager.
CommonScannerManager
Simplest manager that just informs about information was scanned. Doesn't stop propagation of the scanned information.
ScannerManagerWithDelegate
The manager with agile customization.
Passed delegate is used to determine should the read keyboard event be used or ignored.
Also, propagation behavior can be set by the stopWhenCatch
parameter.
AndroidScannerManager
Useful implementation to work with scanners that connected to the Android (only) system device. Android provides more information about a keyboard event, including ID of the source. You can setup your own target list of IDs.
Check specification.
Notice
Language-specific keyboards can have strange IDs out of specification list.
For example, the Cyrillic keyboard on Macbook Pro M1 has ID 769
.
Example
First step create a manager.
final manager = AndroidScannerManager();
And then just subscribe to publisher any way that you need. For example:
StreamBuilder<String>(
stream: manager.scanned,
builder: (_, value) {
return Text('Raw data: ${value.data}');
},
),
Installation
Add qr_hid_reader
to your pubspec.yaml
file:
dependencies:
qr_hid_reader: $currentVersion$
At this moment, the current version of qr_hid_reader
is .
Changelog
All notable changes are mentioned in this file.
Issues
To report your issues, submit them directly in the Issues section.