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
907 stars 521 forks source link

MobileScanner does not detect qr when toggled back on same screen, but works after navigating from previous screen #924

Open hrshere opened 10 months ago

hrshere commented 10 months ago

Actually, I'm using a scan button to show scanner and hide content and vice versa. I have placed my scanner inside a scaffold and a back button is defined which just sets back the boolean used for above mentioned purpose to false, thus showing my content and hiding scanner. When i click on the scan button again, it does shows the scanner again, but no qr could be detected.

I'm using Getx for state Management.

Please help me find if this is a package specific issue ! If yes, how could i fix this. (In example, BarcodeScannerWithOverlay, it uses similar pattern but upon pressing back button in scanner page , it navigates back to previous page, rather than being on same page as in my case)

EhabSalah commented 10 months ago

Same thing, I'm trying to figure out how it works under the hood!

hioshih commented 10 months ago

same issue here. When the screen is rotated and it rebuilds, it no longer triggers detect.

muhammetemircakir commented 10 months ago

@EhabSalah @hrshere @hioshih Hello everyone, I found a solution for this as follows: Dispose of the controller when the scanning is finished or when you close it. Reassign the controller just before running it again.

hrshere commented 10 months ago

Hi @muhammetemircakir , can you share some code snippet for the same? Thank you

Sofrosine commented 9 months ago

hi any update for this?