We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent e712491 commit af2ddc5Copy full SHA for af2ddc5
lib/src/widget/camera_picker.dart
@@ -337,12 +337,17 @@ class CameraPickerState extends State<CameraPicker>
337
if (controller == null || !controller.value.isInitialized) {
338
return;
339
}
340
- if (state == AppLifecycleState.inactive) {
341
- controller?.dispose();
342
- } else if (state == AppLifecycleState.resumed) {
343
- if (controller != null) {
344
- initCameras(currentCamera);
345
- }
+ switch (state) {
+ case AppLifecycleState.resumed:
+ if (controller != null) {
+ initCameras(currentCamera);
+ }
+ break;
346
+ case AppLifecycleState.inactive:
347
+ case AppLifecycleState.paused:
348
+ case AppLifecycleState.detached:
349
+ controller?.dispose();
350
351
352
353
0 commit comments