-
Notifications
You must be signed in to change notification settings - Fork 9.7k
[image_picker] Updated pickImage and pickVideo docs to expose the possible errors that can be thrown #2662
[image_picker] Updated pickImage and pickVideo docs to expose the possible errors that can be thrown #2662
Conversation
cyanglaz
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for doing this! I left some comments!
| 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 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nits:
Returns a [File] object pointing to the image that was picked.
Throws ...
Also, the message might be a little too definitive as there might be other platform exception thrown due to some error caused in the platform. (Like some iOS errors unknown to us), we might want to re-word it a little. Maybe something like "The method could throw a [PlatformException] if..."
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @cyanglaz
Thanks for the feedback! I update the docs to explicit that the method could throw a PlatformException but left the description of the possible exceptions, because I think it is necessary for developers to be aware of the common exceptions that they might have to deal with when reading the documentation. If on the method docs is not the best place, could it be explicit instead on README.md?
Thanks,
freitzzz
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry I didn't make myself clear enough. I meant what you have done is mostly ok, just that we need to indicate there might be other errors besides the ones that you have there.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry I didn't make myself clear enough. I meant what you have done is mostly ok, just that we need to indicate there might be other errors besides the ones that you have there.
Got it! Just updated to reference that PlatformException could also be thrown due to an unknow error. Is it ok for now, or do you think it needs to be rephrased?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@cyanglaz Let me know if you still want these changes
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
absolutely! If you could rebase and resolve the conflicts, I will land this! Thanks again.
…own error a PlatformException could also be thrown
|
It looks like this review got lost. If you could update to resolve the code conflicts and then let me know when it's ready, I can make sure it gets a final review. |
Yes, it sure did. Sorry for the inconvenience, but I totally forgot about it. |
|
I noticed that I had deleted my previous fork of the plugins repo, so I had to create a new PR. Will close this one and ref the new one |
Description
Updated
pickImageandpickVideodocs to expose the possible errors that can be thrown as aPlatformException. The reason I want the docs to be updated with this information is due to developers not being aware of the errors that can be thrown when reading the plugin documentation.Related Issues
No related issues found.
Checklist
Before you create this PR confirm that it meets all requirements listed below by checking the relevant checkboxes (
[x]). This will ensure a smooth and quick review process.///).flutter analyze) does not report any problems on my PR.Breaking Change
Does your PR require plugin users to manually update their apps to accommodate your change?