Navaron Bracke

ignore the already initialized error case

@@ -285,6 +285,13 @@ class MobileScannerController extends ValueNotifier<MobileScannerState> { @@ -285,6 +285,13 @@ class MobileScannerController extends ValueNotifier<MobileScannerState> {
285 ); 285 );
286 } 286 }
287 } on MobileScannerException catch (error) { 287 } on MobileScannerException catch (error) {
  288 + // If the controller is already initialized, ignore the error.
  289 + // Starting the controller while it is already started, or in the process of starting, is redundant.
  290 + if (error.errorCode ==
  291 + MobileScannerErrorCode.controllerAlreadyInitialized) {
  292 + return;
  293 + }
  294 +
288 // The initialization finished with an error. 295 // The initialization finished with an error.
289 // To avoid stale values, reset the output size, 296 // To avoid stale values, reset the output size,
290 // torch state and zoom scale to the defaults. 297 // torch state and zoom scale to the defaults.