Showing
1 changed file
with
5 additions
and
4 deletions
| @@ -297,10 +297,11 @@ class MobileScannerController extends ValueNotifier<MobileScannerState> { | @@ -297,10 +297,11 @@ class MobileScannerController extends ValueNotifier<MobileScannerState> { | ||
| 297 | /// | 297 | /// |
| 298 | /// Does nothing if the camera is already stopped. | 298 | /// Does nothing if the camera is already stopped. |
| 299 | Future<void> stop() async { | 299 | Future<void> stop() async { |
| 300 | - _throwIfNotInitialized(); | ||
| 301 | - | ||
| 302 | - // Do nothing if already stopped. | ||
| 303 | - if (!value.isRunning) { | 300 | + // Do nothing if not initialized or already stopped. |
| 301 | + // On the web, the permission popup triggers a lifecycle change from resumed to inactive, | ||
| 302 | + // due to the permission popup gaining focus. | ||
| 303 | + // This would 'stop' the camera while it is not ready yet. | ||
| 304 | + if (!value.isInitialized || !value.isRunning || _isDisposed) { | ||
| 304 | return; | 305 | return; |
| 305 | } | 306 | } |
| 306 | 307 |
-
Please register or login to post a comment