Closed HTMHell closed 2 years ago
This also does not work, no exception.
static Future<String> decodeQRByData(Uint8List databytes) async {
String barcode = "";
try {
await scanner
.scanBytes(databytes)
.then((value) => barcode = value)
.catchError((e) {
return barcode;
});
} catch (e) {}
return barcode;
}
I/flutter (30105): ------------
W/System.err(30105): com.google.zxing.NotFoundException
W/System (30105): A resource failed to call close.
I/chatty (30105): uid=10134(com.example.app) FinalizerDaemon identical 2 lines
W/System (30105): A resource failed to call close.
I got the same problem, you figured it out?
I got the same problem, you figured it out?
Not really. As a workaround you can set timeout for the future method:
String barcode = await scanner
.scanPath(path)
.timeout(Duration(seconds: 2));
and you should catch the timeout exception, or pass onTimeout
argument to timeout
method.
I got the same problem, you figured it out?
Not really. As a workaround you can set timeout for the future method:
String barcode = await scanner .scanPath(path) .timeout(Duration(seconds: 2));
and you should catch the timeout exception, or pass
onTimeout
argument totimeout
method.
Thank you for response. However I decided not to use image scanning, I used only the camera.
Folks, i made a pull request to allow catching this error. Check this out #92 :)
If I use
scanPath
orscanBytes
to scan an image, and the image doesn't have a barcode, the code keeps waiting instead of returningnull
or throwing an exception or anything like it.For example:
Will print "done" only if the image has a barcode. If not, "done" will never get executed and the code will keep on waiting to
scanner.scanPath
to finish. No exceptions are thrown.