Navaron Bracke

fix torch state

@@ -225,6 +225,9 @@ class MobileScannerController extends ValueNotifier<MobileScannerState> { @@ -225,6 +225,9 @@ class MobileScannerController extends ValueNotifier<MobileScannerState> {
225 cameraDirection: effectiveDirection, 225 cameraDirection: effectiveDirection,
226 isInitialized: true, 226 isInitialized: true,
227 size: viewAttributes.size, 227 size: viewAttributes.size,
  228 + // If the device has a flashlight, let the platform update the torch state.
  229 + // If it does not have one, provide the unavailable state directly.
  230 + torchState: viewAttributes.hasTorch ? null : TorchState.unavailable,
228 ); 231 );
229 } on MobileScannerException catch (error) { 232 } on MobileScannerException catch (error) {
230 if (!_isDisposed) { 233 if (!_isDisposed) {