Showing
1 changed file
with
4 additions
and
4 deletions
| @@ -311,11 +311,11 @@ class MobileScannerController { | @@ -311,11 +311,11 @@ class MobileScannerController { | ||
| 311 | 311 | ||
| 312 | /// Stops the camera, but does not dispose this controller. | 312 | /// Stops the camera, but does not dispose this controller. |
| 313 | Future<void> stop() async { | 313 | Future<void> stop() async { |
| 314 | - try { | ||
| 315 | await _methodChannel.invokeMethod('stop'); | 314 | await _methodChannel.invokeMethod('stop'); |
| 316 | - } catch (e) { | ||
| 317 | - debugPrint('$e'); | ||
| 318 | - } | 315 | + |
| 316 | + // After the camera stopped, set the torch state to off, | ||
| 317 | + // as the torch state callback is never called when the camera is stopped. | ||
| 318 | + torchState.value = TorchState.off; | ||
| 319 | } | 319 | } |
| 320 | 320 | ||
| 321 | /// Switches the torch on or off. | 321 | /// Switches the torch on or off. |
-
Please register or login to post a comment