flutter_zxing
flutter_zxing copied to clipboard
Unable to recognize the QR code from the image, the Codes are empty strings on Android and iOS
Please fix this issue as soon as possible, otherwise I'll have to add another image QR code recognition library for this.
Device:Xiaomi 13、iPhone 14 Pro
`I/flutter (30296): [E] zx.readBarcodeImagePathString : code==null --> false
I/flutter (30296): [E] zx.readBarcodeImagePathString : code.text -->
I/flutter (30296): [E] zx.readBarcodeImagePathString : code.text.length --> 0`
Hello @b-fab-michael, could you kindly share the demo image required to replicate your problem? Thank you.
Hello @b-fab-michael, could you kindly share the demo image required to replicate your problem? Thank you.
` void _onPicTap() async { final res = await ImagePickerUtils.pickerPaths( galleryMode: GalleryMode.image, selectCount: 1, showGif: false, compressSize: 5120, ); File file = File(res[0].path ?? ''); Code? qrcode = await zx.readBarcodeImagePathString(file.path); LogUtil.e('zx.readBarcodeImagePathString : code==null --> ${qrcode==null}'); LogUtil.e('zx.readBarcodeImagePathString : code.text --> ${qrcode?.text}'); LogUtil.e('zx.readBarcodeImagePathString : code.text.length --> ${qrcode?.text?.length}'); if (qrcode != null) { OXNavigator.pop(context, qrcode.text); } else { CommonToast.instance.show(context, "str_invalid_qr_code".commonLocalized()); } }
`
This is my code. Please tell me. Is there anything else I need to improve?
@khoren93 I am also getting always isValid = false and empty result from scanned images.
@b-fab-michael @ozkayas please check the v1.5.2. Thanks!
Doesn't work with any QR code image I've tried. I've using version 1.5.2.
For testing purposes, I created a QR with an online tool from the string "Test123" and selected it with the file_selector package.
Inside of the same widget:
@OverRide void initState() { zx.startCameraProcessing(); super.initState(); }
@OverRide void dispose() { zx.stopCameraProcessing(); super.dispose(); }
My Code: final XFile? file = await openFile(); if (file == null) return; log('Selected file: ${file.path}'); log('FileBytes: ${(await file.readAsBytes()).length}'); final result = await zx.readBarcodeImagePath(file); log('ResultDuration: ${result.duration}'); log('ResultError: ${result.error}'); log('ResultFormat: ${result.format}'); log('ResultIsInverted: ${result.isInverted}'); log('ResultIsMirrored: ${result.isMirrored}'); log('ResultIsValid: ${result.isValid}'); log('ResultPosition: ${result.position}'); log('ResultRawBytes: ${result.rawBytes}'); log('ResultText: ${result.text}');
Output: [log] Selected file: content://com.android.providers.media.documents/document/image%3A1000000179 [log] FileBytes: 26487 [log] ResultDuration: 23 [log] ResultError: [log] ResultFormat: 0 [log] ResultIsInverted: false [log] ResultIsMirrored: false [log] ResultIsValid: false [log] ResultPosition: Instance of 'Position' [log] ResultRawBytes: null [log] ResultText:
It there any solution yet as I am also facing same issue. Not able to scan qr code from gallery image
Same issue and I can't find any solution for that. There is my code & image, i test it in android api 34 & 29
Future