Navaron Bracke

fix bug in app lifecycle guidance

... ... @@ -7,6 +7,9 @@ Improvements:
* [web] Added the size information to barcode results.
* Added support for barcode formats to image analysis.
* Updated the scanner to report any scanning errors that were encountered during processing.
* Introduced a new getter `hasCameraPermission` for the `MobileScannerState`.
* Fixed a bug in the lifecycle handling sample. Now instead of checking `isInitialized`,
the sample recommends using `hasCameraPermission`, which also guards against camera permission errors.
Bugs fixed:
* Fixed a bug that would cause the scanner to emit an error when it was already started. Now it ignores any calls to start while it is starting.
... ...
... ... @@ -127,7 +127,7 @@ class MyState extends State<MyStatefulWidget> with WidgetsBindingObserver {
void didChangeAppLifecycleState(AppLifecycleState state) {
// If the controller is not ready, do not try to start or stop it.
// Permission dialogs can trigger lifecycle changes before the controller is ready.
if (!controller.value.isInitialized) {
if (!controller.value.hasCameraPermission) {
return;
}
... ... @@ -192,4 +192,4 @@ Future<void> dispose() async {
To display the camera preview, pass the controller to a `MobileScanner` widget.
See the [examples](example/README.md) for runnable examples of various usages,
such as the basic usage, applying a scan window, or retrieving images from the barcodes.
such as the basic usage, applying a scan window, or retrieving images from the barcodes.
\ No newline at end of file
... ...