Skip to content

Commit 9c43d4b

Browse files
committed
fix check after await
1 parent 5afe109 commit 9c43d4b

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

lib/src/mobile_scanner_controller.dart

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -357,6 +357,17 @@ class MobileScannerController extends ValueNotifier<MobileScannerState> {
357357
),
358358
);
359359
});
360+
361+
// Abort if the controller was disposed
362+
// while waiting for the widget to be attached.
363+
if (_isDisposed) {
364+
throw MobileScannerException(
365+
errorCode: MobileScannerErrorCode.controllerDisposed,
366+
errorDetails: MobileScannerErrorDetails(
367+
message: MobileScannerErrorCode.controllerDisposed.message,
368+
),
369+
);
370+
}
360371
}
361372

362373
if (cameraDirection == CameraFacing.unknown) {

0 commit comments

Comments
 (0)