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
744 stars 444 forks source link

fix: Release barcode scanner when not in use #991

Open navaronbracke opened 2 months ago

navaronbracke commented 2 months ago

TODO: test with StrictMode & returnImage: true, since those code paths have changed TODO: do the same fix for iOS TODO: remove the assert for analyzeImage() TODO: let analyzeImage() take the formats from the controller

This PR updates the Android implementation to release the BarcodeScanner when it is no longer used.

It also reflows some blocks of code that could have used early returns and the like.

Fixes #988