We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
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
The text was updated successfully, but these errors were encountered:
dispose方法在最后面加一句 _subscription = null; 就ok了
Sorry, something went wrong.
升级版本到 pda_scanner: ^0.2.8 试试
No branches or pull requests
Steps to Reproduce
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;
});
}
}
Logs
第一次在释放生命周期的时候会提示 PdaScannerPlugin:onCancel;
I/PdaScannerPlugin( 4629): PdaScannerPlugin:onCancel
The text was updated successfully, but these errors were encountered: