PDA Scanner

License Pub

A Flutter plugin 🛠 to scanning. Ready for PDA 🚀

pda_scanner.gif

Installation

Add this to your package's pubspec.yaml file:

dependencies:
 pda_scanner: ^0.0.1

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.