From 076ffda7fc62a95ea96888458176e56b4c5ea6d1 Mon Sep 17 00:00:00 2001 From: Alex Li Date: Mon, 23 Dec 2024 15:28:11 +0800 Subject: [PATCH 1/2] =?UTF-8?q?=F0=9F=90=9B=20Wrap=20controller=20methods?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/src/states/camera_picker_state.dart | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/lib/src/states/camera_picker_state.dart b/lib/src/states/camera_picker_state.dart index 3c5bca8..1144aad 100644 --- a/lib/src/states/camera_picker_state.dart +++ b/lib/src/states/camera_picker_state.dart @@ -966,15 +966,19 @@ class CameraPickerState extends State } wrapControllerMethod( 'setFocusMode', - () => controller.setFocusMode(FocusMode.auto), + () async { + await innerController?.setFocusMode(FocusMode.auto); + }, ); if (previousExposureMode != ExposureMode.locked) { wrapControllerMethod( 'setExposureMode', - () => controller.setExposureMode(previousExposureMode), + () async { + await innerController?.setExposureMode(previousExposureMode); + }, ); } - await controller.resumePreview(); + await innerController?.resumePreview(); } catch (e, s) { handleErrorWithHandler(e, s, pickerConfig.onError); } finally { @@ -1092,13 +1096,13 @@ class CameraPickerState extends State ); if (entity != null) { if (pickerConfig.onPickConfirmed case final onPickConfirmed?) { - await controller.resumePreview(); + await innerController?.resumePreview(); onPickConfirmed(entity); } else { Navigator.of(context).pop(entity); } } else { - await controller.resumePreview(); + await innerController?.resumePreview(); } } catch (e, s) { recordCountdownTimer?.cancel(); From df75145af413af6f3f01402d6eaf9253ddca953b Mon Sep 17 00:00:00 2001 From: Alex Li Date: Sun, 2 Feb 2025 21:41:26 +0800 Subject: [PATCH 2/2] =?UTF-8?q?=F0=9F=93=9D=20CHANGELOG?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index d00b4ca..b92d639 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -29,6 +29,7 @@ See the [Migration Guide](guides/migration_guide.md) for breaking changes betwee ### Fixes - Fix preview file delete predication. +- Avoid potential null operations when saving the entity. ## 4.3.3