xindalu_scan_flutter 0.0.3
xindalu_scan_flutter: ^0.0.3 copied to clipboard
新大陆手持设备红外扫描识别插件by_flutter
xindalu_scan_flutter #
新大陆手持设备红外扫描识别插件by_flutter
安装 #
dependencies:
xindalu_scan_flutter: ^0.0.3
初始化 #
定义参数
static const String KEY = 'xindalu_scan';//自定义key,固定值,修改会启动报错
static const EventChannel _eventChannel = EventChannel(key);
然后在initState
初始化
await XindaluScanFlutter.init(config); // 如果不配置,将使用官方默认值
使用默认配置
await XindaluScanFlutter.init(Map());
config
只能自定义这3个参数,其他修改无效,不过这也够用了
Map<String, dynamic> config = Map();
config["extra1"] = "code1";//对应下面的条码1Extra
config["extra2"] = "code2"; //对应下面的条码2Extra
config['barcodeType'] = "SCAN_BARCODE_TYPE";//对应下面的码制类型
监听扫描数据 #
在需要获取到扫描数据的页面,声明周期initState
监听
_eventChannel.receiveBroadcastStream().listen((value) {
print("获取到扫描头数据>>>>>>>>>>$value");
});
常见问题 #
- 引入插件后报错
I/flutter (31823): MissingPluginException(No implementation found for method listen on channel xindalu_scan/send)
初始化一下就行了
附件 #
待更新