From 7888bac79f7e3616ab67d88fe5fc59b62b5072db Mon Sep 17 00:00:00 2001 From: freitzzz <1160907@isep.ipp.pt> Date: Fri, 17 Apr 2020 17:07:22 +0100 Subject: [PATCH 1/4] Updated pickImage and pickVideo docs to expose the possible errors that can be thrown --- packages/image_picker/lib/image_picker.dart | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/packages/image_picker/lib/image_picker.dart b/packages/image_picker/lib/image_picker.dart index 9b0754da1975..6e2999365f47 100755 --- a/packages/image_picker/lib/image_picker.dart +++ b/packages/image_picker/lib/image_picker.dart @@ -44,7 +44,11 @@ class ImagePicker { static const MethodChannel _channel = MethodChannel('plugins.flutter.io/image_picker'); - /// Returns a [File] object pointing to the image that was picked. + /// Returns a [File] object pointing to the image that was picked or throws + /// a [PlatformException] if the app does not have permission to access + /// the camera or photos gallery, no camera is available, plugin is already in use, + /// temporary file could not be created (iOS only) or plugin activity could not + /// be allocated (Android only). /// /// The `source` argument controls where the image comes from. This can /// be either [ImageSource.camera] or [ImageSource.gallery]. @@ -96,7 +100,11 @@ class ImagePicker { return path == null ? null : File(path); } - /// Returns a [File] object pointing to the video that was picked. + /// Returns a [File] object pointing to the video that was picked or throws + /// a [PlatformException] if the app does not have permission to access + /// the camera or photos gallery, no camera is available, plugin is already in use, + /// temporary file could not be created and video could not be cached (iOS only) + /// or plugin activity could not be allocated (Android only). /// /// The [source] argument controls where the video comes from. This can /// be either [ImageSource.camera] or [ImageSource.gallery]. From 6c73545b9fe565309f233525f4d7b3e51bf07bec Mon Sep 17 00:00:00 2001 From: freitzzz <1160907@isep.ipp.pt> Date: Fri, 17 Apr 2020 17:28:16 +0100 Subject: [PATCH 2/4] Updated plugin version on pubspec.yaml and CHANGELOG.md --- packages/image_picker/CHANGELOG.md | 4 ++++ packages/image_picker/pubspec.yaml | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/packages/image_picker/CHANGELOG.md b/packages/image_picker/CHANGELOG.md index b6f787a2ecac..3cbdc5992186 100644 --- a/packages/image_picker/CHANGELOG.md +++ b/packages/image_picker/CHANGELOG.md @@ -1,3 +1,7 @@ +## 0.6.5+1 + +* Expose errors thrown in `pickImage` and `pickVideo` docs. + ## 0.6.5 * Set maximum duration for video recording. diff --git a/packages/image_picker/pubspec.yaml b/packages/image_picker/pubspec.yaml index df8879e05a6a..523668071e48 100755 --- a/packages/image_picker/pubspec.yaml +++ b/packages/image_picker/pubspec.yaml @@ -2,7 +2,7 @@ name: image_picker description: Flutter plugin for selecting images from the Android and iOS image library, and taking new pictures with the camera. homepage: https://github.com/flutter/plugins/tree/master/packages/image_picker -version: 0.6.5 +version: 0.6.5+1 flutter: plugin: From 72eac695fee2a09cd532581bee368f788a7a1490 Mon Sep 17 00:00:00 2001 From: freitzzz <1160907@isep.ipp.pt> Date: Tue, 21 Apr 2020 18:36:19 +0100 Subject: [PATCH 3/4] Updated how pickImage and pickVideo docs were referencing PlatformException throw --- packages/image_picker/lib/image_picker.dart | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/packages/image_picker/lib/image_picker.dart b/packages/image_picker/lib/image_picker.dart index 6e2999365f47..c3b54990b593 100755 --- a/packages/image_picker/lib/image_picker.dart +++ b/packages/image_picker/lib/image_picker.dart @@ -44,8 +44,9 @@ class ImagePicker { static const MethodChannel _channel = MethodChannel('plugins.flutter.io/image_picker'); - /// Returns a [File] object pointing to the image that was picked or throws - /// a [PlatformException] if the app does not have permission to access + /// Returns a [File] object pointing to the image that was picked. + /// + /// The method could throw [PlatformException] if the app does not have permission to access /// the camera or photos gallery, no camera is available, plugin is already in use, /// temporary file could not be created (iOS only) or plugin activity could not /// be allocated (Android only). @@ -100,8 +101,9 @@ class ImagePicker { return path == null ? null : File(path); } - /// Returns a [File] object pointing to the video that was picked or throws - /// a [PlatformException] if the app does not have permission to access + /// Returns a [File] object pointing to the video that was picked. + /// + /// The method could throw [PlatformException] if the app does not have permission to access /// the camera or photos gallery, no camera is available, plugin is already in use, /// temporary file could not be created and video could not be cached (iOS only) /// or plugin activity could not be allocated (Android only). From a0de9d0b04567a1721fd3b7e1818d909053a246f Mon Sep 17 00:00:00 2001 From: freitzzz <1160907@isep.ipp.pt> Date: Tue, 21 Apr 2020 19:00:51 +0100 Subject: [PATCH 4/4] Update pickImage and pickVideo docks to reference that due to an unknown error a PlatformException could also be thrown --- packages/image_picker/lib/image_picker.dart | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/packages/image_picker/lib/image_picker.dart b/packages/image_picker/lib/image_picker.dart index c3b54990b593..72869012b308 100755 --- a/packages/image_picker/lib/image_picker.dart +++ b/packages/image_picker/lib/image_picker.dart @@ -48,8 +48,8 @@ class ImagePicker { /// /// The method could throw [PlatformException] if the app does not have permission to access /// the camera or photos gallery, no camera is available, plugin is already in use, - /// temporary file could not be created (iOS only) or plugin activity could not - /// be allocated (Android only). + /// temporary file could not be created (iOS only), plugin activity could not + /// be allocated (Android only) or due to an unknown error. /// /// The `source` argument controls where the image comes from. This can /// be either [ImageSource.camera] or [ImageSource.gallery]. @@ -105,8 +105,8 @@ class ImagePicker { /// /// The method could throw [PlatformException] if the app does not have permission to access /// the camera or photos gallery, no camera is available, plugin is already in use, - /// temporary file could not be created and video could not be cached (iOS only) - /// or plugin activity could not be allocated (Android only). + /// temporary file could not be created and video could not be cached (iOS only), + /// plugin activity could not be allocated (Android only) or due to an unknown error. /// /// The [source] argument controls where the video comes from. This can /// be either [ImageSource.camera] or [ImageSource.gallery].