Navaron Bracke
Committed by GitHub

Merge pull request #1036 from EArminjon/bug/widget-disposed-during-start

fix: widget-disposed-during-start
## 5.0.2
Bugs fixed:
* Fixed a crash when the controller is disposed while it is still starting. [#1036](https://github.com/juliansteenbakker/mobile_scanner/pull/1036) (thanks @EArminjon !)
## 5.0.1
Improvements:
... ...
... ... @@ -274,16 +274,18 @@ class MobileScannerController extends ValueNotifier<MobileScannerState> {
options,
);
value = value.copyWith(
availableCameras: viewAttributes.numberOfCameras,
cameraDirection: effectiveDirection,
isInitialized: true,
isRunning: true,
size: viewAttributes.size,
// If the device has a flashlight, let the platform update the torch state.
// If it does not have one, provide the unavailable state directly.
torchState: viewAttributes.hasTorch ? null : TorchState.unavailable,
);
if (!_isDisposed) {
value = value.copyWith(
availableCameras: viewAttributes.numberOfCameras,
cameraDirection: effectiveDirection,
isInitialized: true,
isRunning: true,
size: viewAttributes.size,
// If the device has a flashlight, let the platform update the torch state.
// If it does not have one, provide the unavailable state directly.
torchState: viewAttributes.hasTorch ? null : TorchState.unavailable,
);
}
} on MobileScannerException catch (error) {
// The initialization finished with an error.
// To avoid stale values, reset the output size,
... ...
name: mobile_scanner
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.
version: 5.0.1
version: 5.0.2
repository: https://github.com/juliansteenbakker/mobile_scanner
screenshots:
... ... @@ -24,7 +24,7 @@ dependencies:
sdk: flutter
flutter_web_plugins:
sdk: flutter
plugin_platform_interface: ^2.0.2
plugin_platform_interface: ^2.0.2
web: ^0.5.1
dev_dependencies:
... ...