Committed by
GitHub
Merge pull request #1036 from EArminjon/bug/widget-disposed-during-start
fix: widget-disposed-during-start
Showing
3 changed files
with
8 additions
and
1 deletions
| @@ -274,6 +274,7 @@ class MobileScannerController extends ValueNotifier<MobileScannerState> { | @@ -274,6 +274,7 @@ class MobileScannerController extends ValueNotifier<MobileScannerState> { | ||
| 274 | options, | 274 | options, |
| 275 | ); | 275 | ); |
| 276 | 276 | ||
| 277 | + if (!_isDisposed) { | ||
| 277 | value = value.copyWith( | 278 | value = value.copyWith( |
| 278 | availableCameras: viewAttributes.numberOfCameras, | 279 | availableCameras: viewAttributes.numberOfCameras, |
| 279 | cameraDirection: effectiveDirection, | 280 | cameraDirection: effectiveDirection, |
| @@ -284,6 +285,7 @@ class MobileScannerController extends ValueNotifier<MobileScannerState> { | @@ -284,6 +285,7 @@ class MobileScannerController extends ValueNotifier<MobileScannerState> { | ||
| 284 | // If it does not have one, provide the unavailable state directly. | 285 | // If it does not have one, provide the unavailable state directly. |
| 285 | torchState: viewAttributes.hasTorch ? null : TorchState.unavailable, | 286 | torchState: viewAttributes.hasTorch ? null : TorchState.unavailable, |
| 286 | ); | 287 | ); |
| 288 | + } | ||
| 287 | } on MobileScannerException catch (error) { | 289 | } on MobileScannerException catch (error) { |
| 288 | // The initialization finished with an error. | 290 | // The initialization finished with an error. |
| 289 | // To avoid stale values, reset the output size, | 291 | // To avoid stale values, reset the output size, |
| 1 | name: mobile_scanner | 1 | name: mobile_scanner |
| 2 | description: A universal barcode and QR code scanner for Flutter based on MLKit. Uses CameraX on Android, AVFoundation on iOS and Apple Vision & AVFoundation on macOS. | 2 | description: A universal barcode and QR code scanner for Flutter based on MLKit. Uses CameraX on Android, AVFoundation on iOS and Apple Vision & AVFoundation on macOS. |
| 3 | -version: 5.0.1 | 3 | +version: 5.0.2 |
| 4 | repository: https://github.com/juliansteenbakker/mobile_scanner | 4 | repository: https://github.com/juliansteenbakker/mobile_scanner |
| 5 | 5 | ||
| 6 | screenshots: | 6 | screenshots: |
-
Please register or login to post a comment