What package does this bug report belong to?
image_picker
What target platforms are you seeing this bug on?
iOS, Android
Have you already upgraded your packages?
Yes
Details
Currently the image_picker's pickMultiImage method errors if a limit of 1 is passed to it. I assume this is the case because the intention is for the pickImage method to be used in this case.
If the limit is being calculated at runtime, of course it is simple to check the calculated limit and conditionally invoke either pickImage or pickMultiImage if the limit is 1.
However, this behaviour is not documented anywhere. My app calculates the limit dynamically based on how many images have already been selected. It was only by chance when testing a new feature that I noticed my code was erroring if the limit resolved to 1.
I was wondering if at minimum some documentation around the limit method could be added to the package's README explaining this gotcha.
However, a nicer solution might be to make the package automatically fall back to using the pickImage method if a limit of 1 is passed to the pickMultiImage method. That would minimise the chance of someone's app erroring unexpectedly.
Steps to reproduce
Invoke the pickMultiImage method with a limit of 1
Expected results
The package should handle this scenario gracefully
Actual results
The package throws an error
What package does this bug report belong to?
image_picker
What target platforms are you seeing this bug on?
iOS, Android
Have you already upgraded your packages?
Yes
Details
Currently the image_picker's
pickMultiImagemethod errors if alimitof 1 is passed to it. I assume this is the case because the intention is for thepickImagemethod to be used in this case.If the limit is being calculated at runtime, of course it is simple to check the calculated
limitand conditionally invoke either pickImage or pickMultiImage if the limit is 1.However, this behaviour is not documented anywhere. My app calculates the
limitdynamically based on how many images have already been selected. It was only by chance when testing a new feature that I noticed my code was erroring if the limit resolved to 1.I was wondering if at minimum some documentation around the
limitmethod could be added to the package's README explaining this gotcha.However, a nicer solution might be to make the package automatically fall back to using the pickImage method if a limit of 1 is passed to the pickMultiImage method. That would minimise the chance of someone's app erroring unexpectedly.
Steps to reproduce
Invoke the
pickMultiImagemethod with alimitof 1Expected results
The package should handle this scenario gracefully
Actual results
The package throws an error