pda_scanner 0.1.4 pda_scanner: ^0.1.4 copied to clipboard
This is a scanning plug-in for PDA(Dong ji Xiao ma ge) to Listen for scanned events and get results.
PDA Scanner #
A Flutter plugin 🛠 to scanning. Ready for PDA 🚀
Installation #
Add this to your package's pubspec.yaml file:
dependencies:
pda_scanner: ^0.1.4
Usage example #
static const scannerPlugin = const EventChannel('com.shinow.pda_scanner/plugin');
StreamSubscription _subscription;
var _code;
@override
void initState() {
super.initState();
if (_subscription == null) {
_subscription = scannerPlugin
.receiveBroadcastStream()
.listen(_onEvent, onError: _onError);
}
}
@override
void dispose() {
super.dispose();
if (_subscription != null) {
_subscription.cancel();
}
}
void _onEvent(Object event) {
setState(() {
_code = event;
print("ChannelPage: $event");
});
}
void _onError(Object error) {
setState(() {
_code = "扫描异常";
print(error);
});
}
Contribute #
We would ❤️ to see your contribution!
License #
Distributed under the MIT license. See LICENSE
for more information.
About #
Created by Shusheng.