wu9007 / pda_scanner Goto Github PK
View Code? Open in Web Editor NEW🚀A Flutter plugin to scanning. Ready for PDA
License: MIT License
🚀A Flutter plugin to scanning. Ready for PDA
License: MIT License
之前的版本很好用,但是flutter2.0以后,需要支持null safety,请升级一下吧,非常感谢
class _MainPageState extends State with PdaListenerMixin {
var _code;
@OverRide
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(),
body: Container(
child: TextField(
focusNode: new FocusNode(),
onEditingComplete: () {
print("回车");
},
onSubmitted: (value) {
print("值:" + value);
},
),
),
);
}
@OverRide
void onEvent(Object event) {
print(event);
}
@OverRide
void onError(Object error) {
print(error);
}
}
1.当我首次初始化pda_scanner的时候,用扫码枪扫描是可以得到条码的信息的,但是当我离开页面的时候再次进入 扫描就没有反应了
import 'package:flutter/material.dart';
import 'package:pda_scanner/pda_source.dart';
import 'package:pda_scanner/pda_listener_mixin.dart';
class PdaScan extends StatefulWidget {
@OverRide
_PdaScanState createState() => _PdaScanState();
}
class _PdaScanState extends State with PdaListenerMixin {
var _code;
var _error;
@OverRide
void initState() {
print('init');
PdaSource.init();
super.initState();
}
@OverRide
void dispose() {
print('dispose');
PdaSource.dispose();
super.dispose();
}
@OverRide
Widget build(BuildContext context) {
return Scaffold(
body: Container(
child: Center(
child: Text('$_code'),
)
),
);
}
@OverRide
void onEvent(Object code) {
// TODO: implement onEvent
setState(() {
_code=code;
});
}
@OverRide
void onError(Object error) {
// TODO: implement onError
print(error);
setState(() {
_error=error;
});
}
}
第一次在释放生命周期的时候会提示 PdaScannerPlugin:onCancel;
I/PdaScannerPlugin( 4629): PdaScannerPlugin:onCancel
It needs to support null security, please update it, thank you very much
Hi, I have imported the pda_listener.dar & pda_source.dart files, but when I run mi application in debug mode and use print() sentences in order to track the execution order, the onEvent event is not triggered.
After to finish the execution, the next message appears:
I/PdaScannerPlugin(17438): PdaScannerPlugin:onCancel
Also I have test with the example posted in git with the same results.
I'm working with a Honeywell - EDA50 - SO Android 7.1.1 device.
Do I need to configure something particular in the device or do you think that I missing something?
Hi,
I am trying the example project on Urovo DT50, the app started without problems but onEvent and onError isn't triggered when I scan any barcode.
Hello,
I am just trying the example project on Honeywell CT60 , the app started without problems but onEvent and onError isn't triggered when I scan any barcode
Flutter:2.2.2
Dart 2.13.3
pda_scanner: ^0.2.9
Launching lib\main.dart on PDT 90P in debug mode...
lib\main.dart:1
√ Built build\app\outputs\flutter-apk\app-debug.apk.
Connecting to VM Service at ws://127.0.0.1:51123/JgsC93lg0fE=/ws
D/AndroidRuntime(21619): Shutting down VM
E/AndroidRuntime(21619): FATAL EXCEPTION: main
E/AndroidRuntime(21619): Process: com.example.ys_pda, PID: 21619
E/AndroidRuntime(21619): java.lang.RuntimeException: Error receiving broadcast Intent { act=com.android.server.scannerservice.broadcast flg=0x10 (has extras) } in com.shinow.pda_scanner.PdaScannerPlugin$1@3aeda31f
E/AndroidRuntime(21619): at android.app.LoadedApk$ReceiverDispatcher$Args.run(LoadedApk.java:876)
E/AndroidRuntime(21619): at android.os.Handler.handleCallback(Handler.java:739)
E/AndroidRuntime(21619): at android.os.Handler.dispatchMessage(Handler.java:95)
E/AndroidRuntime(21619): at android.os.Looper.loop(Looper.java:135)
E/AndroidRuntime(21619): at android.app.ActivityThread.main(ActivityThread.java:5254)
E/AndroidRuntime(21619): at java.lang.reflect.Method.invoke(Native Method)
E/AndroidRuntime(21619): at java.lang.reflect.Method.invoke(Method.java:372)
E/AndroidRuntime(21619): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:902)
E/AndroidRuntime(21619): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:697)
E/AndroidRuntime(21619): Caused by: java.lang.NullPointerException: Attempt to invoke interface method 'void io.flutter.plugin.common.EventChannel$EventSink.success(java.lang.Object)' on a null object reference
E/AndroidRuntime(21619): at com.shinow.pda_scanner.PdaScannerPlugin$1.onReceive(PdaScannerPlugin.java:30)
E/AndroidRuntime(21619): at android.app.LoadedApk$ReceiverDispatcher$Args.run(LoadedApk.java:866)
E/AndroidRuntime(21619): ... 8 more
I/Process (21619): Sending signal. PID: 21619 SIG: 9
Lost connection to device.
Exited (sigterm)
遇到以下的问题。可能必须升级?
The plugin `flutter_pda_scanner` uses a deprecated version of the Android embedding.
To avoid unexpected runtime failures, or future build failures, try to see if this plugin supports the Android V2 embedding. Otherwise, consider removing it since a future release of Flutter will remove these deprecated APIs.
If you are plugin author, take a look at the docs for migrating the plugin to the V2 embedding: [https://flutter.dev/go/android-plugin-migration]().
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.