Skip to content
Merged
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions lib/src/states/camera_picker_state.dart
Original file line number Diff line number Diff line change
Expand Up @@ -199,12 +199,16 @@ class CameraPickerState extends State<CameraPicker>
@override
void didChangeAppLifecycleState(AppLifecycleState state) {
final CameraController? c = innerController;
if (c == null && state == AppLifecycleState.resumed) {
initCameras(currentCamera);
}
// App state changed before we got the chance to initialize.
if (c == null || !c.value.isInitialized) {
return;
}
if (state == AppLifecycleState.inactive) {
c.dispose();
innerController = null;
} else if (state == AppLifecycleState.resumed) {
initCameras(currentCamera);
}
Expand Down