juliansteenbakker / mobile_scanner

A universal scanner for Flutter based on MLKit. Uses CameraX on Android and AVFoundation on iOS.
BSD 3-Clause "New" or "Revised" License
897 stars 514 forks source link

Bug: Can't scan from the second time #571

Open burekas7 opened 1 year ago

burekas7 commented 1 year ago

I build the MobileScanner on initState. After the first scan I'm doing setState, but when trying to scan the next time I'm getting this error: 'Unhandled Exception: Bad state: Cannot add new events after calling close"

Why the stream is closed after the first screen, how to keep it open?

The controller is set like this: MobileScannerController(detectionSpeed: DetectionSpeed.unrestricted);

edrianbiagi commented 1 year ago

I also have this same problem. Did you get anything?

I check if the qrcode was read correctly. If it returns status 400, it displays the error message. The camera is still enabled, but it is not possible to read a new qrcode.

final scannerController = MobileScannerController( formats: [BarcodeFormat.qrCode], autoStart: true, detectionSpeed: DetectionSpeed.normal, );

kenwen commented 1 year ago

I'm getting similar but no error message. I'm using a standard barcode. The scanner reads for the first time, then when I stop and restart, it doesn't read any further

ftecnologiasistemas commented 1 year ago

Any news about this problem? This happens to me too! I can't read a qrcode sequentially

georges-ph commented 1 year ago

I faced that problem too. I was calling the stop() method. I had to remove it

arok commented 1 year ago

Should be fixed here https://github.com/arok/mobile_scanner/tree/fix_scanning

berger89 commented 1 year ago

@arok can you please create a pull request for the fix?

incon commented 1 year ago

I have the same issue

AlexandrGurenko commented 1 year ago

+1