File tree Expand file tree Collapse file tree 1 file changed +7
-3
lines changed
Expand file tree Collapse file tree 1 file changed +7
-3
lines changed Original file line number Diff line number Diff line change @@ -460,13 +460,17 @@ class CameraPickerState extends State<CameraPicker>
460460
461461 @override
462462 void didChangeAppLifecycleState (AppLifecycleState state) {
463+ final CameraController ? c = _controller;
463464 // App state changed before we got the chance to initialize.
464- if (_controller == null || ! controller .value.isInitialized) {
465+ if (c == null || ! c .value.isInitialized) {
465466 return ;
466467 }
467468 if (state == AppLifecycleState .inactive) {
468- controller.dispose ();
469- } else if (state == AppLifecycleState .resumed) {
469+ c.dispose ();
470+ } else if (state == AppLifecycleState .resumed && ! c.value.isInitialized) {
471+ // Drop initialize when the controller has been already initialized.
472+ // This will typically resolve the lifecycle issue on iOS when permissions
473+ // are requested for the first time.
470474 initCameras (currentCamera);
471475 }
472476 }
You can’t perform that action at this time.
0 commit comments