flutter
flutter copied to clipboard
image_picker add picture limit to getMultiImage
Hi,
It would be great to have ability to set limit on amount of pictures that can be selected. e.g. maxPictures: 3
Can you give more explanation? Do you want to limit the number of photos at one time, or limit the number of photos that he can choose in the long run?
At one time. When I open image picker it would be good to allow user select max upto N photos.
plugin version https://pub.dev/packages/image_picker/changelog#0812 added multi-image selection feature.

@darshankawar this proposal is about limit of multi-image selection. Or you just dropped comments for others? :)
Hi @vytautas-pranskunas-,
We can have this feature for iOS but it seems there is no way to do it for Android. We are using EXTRA_ALLOW_MULTIPLE
to fetch multiple images on Android and as it is stated in here it is not possible with the current implementation. If someone knows another way to handle please let us know. We would be happy to work on this.
But for the moment, since the support is only limited to iOS I will discuss within the team if we want to implement it for iOS only.
As mentioned by @ydag, this functionality is only supported on iOS and won't work on other platforms (Android and Web). So we are wondering if this will still add value if it is only supported on iOS.
We can imagine that it will give a bit better user experience on iOS were users are simply not able to select more than the maximum amount of images. But this means developers should still handle the other platforms in their own logic (e.g. show the user a warning when more than the maximum amount of images are selected).
If you would like this feature to be implemented with support for iOS only please leave a 👍 on this comment. When we generate enough feedback we will provide the necessary implementation.
This thread has been automatically locked since there has not been any recent activity after it was closed. If you are still experiencing a similar issue, please open a new bug, including the output of flutter doctor -v
and a minimal reproduction of the issue.
Re-opening based on the use case described in https://github.com/flutter/flutter/issues/116588#issuecomment-1339681035; having a best-effort plugin cutoff even on unsupported platform would allow us to bypass steps like resampling images for those past the cutoff. We would just need to be very clear in the API docs that on some platforms the UX of this won't actually prevent users from thinking they are picking more images.
Now also android has native support for this feature, and image_picker package already can use the Android PhotoPicker.
One of the issues would be the API compatibility, officially Android 11 (API level 30) or higher
, but with an entry in the manifest the API can force the installation of the photopicker by google play services.
I think Image_picker should return and error if the platform or device doesn't have support for the feature, so developers can rely in call getImage multiples times, or use a custom image picker, like other flutter packages implementations.
any updates on adding the limit for pickMultiImage()?
is it possible to make a callback directly, the PickMultiVisualMedia(maxImage) method from native android
open class PickMultipleVisualMedia(
private val maxItems: Int = getMaxItems()
)
Please see https://github.com/flutter/flutter/wiki/Issue-hygiene#when-will-my-bug-be-fixed and https://github.com/flutter/flutter/wiki/Issue-hygiene#escalating-an-issue-that-has-the-wrong-priority
Pinging everyone who has touched a bug is not a valid escalation path. Please don't do that.
any update on this feature? are you guys planning to integrate this feature in package?
is it possible to make a callback directly, the PickMultiVisualMedia(maxImage) method from native android
open class PickMultipleVisualMedia( private val maxItems: Int = getMaxItems() )
Has anybody implemented this in Flutter?
I think Image_picker should return and error if the platform or device don't have support for the feature
The pattern we use for things like this is generally https://github.com/flutter/flutter/wiki/Contributing-to-Plugins-and-Packages#api-support-queries, not erroring out.
I get that an old Android limitation was stalling this PR. But there's a solution now in the Android docs. Is it not enough? https://developer.android.com/training/data-storage/shared/photopicker#select-multiple-items
They also provided solution for backward compatibility https://developer.android.com/training/data-storage/shared/photopicker#device-availability
I get that an old Android limitation was stalling this PR.
There's no PR here, only a feature request. Anyone interested in implementing this is welcome to submit a PR (which has been the case since this comment).
Any updates on the limit option? Has it been added?
Any updates on this feature? It's really important for apps that restrict the number of images to be picked. You do not want the user to pick 10 images then say, you can only save 4 of them...
Thanks...
Any updates on the limit option? Has it been added?
Why it has been marked as off-topic?
Why it has been marked as off-topic?
See https://github.com/flutter/flutter/wiki/Issue-hygiene#do-not-add-me-too-or-same-or-is-there-an-update-comments-to-bugs
@darshankawar pickMultiImage not work in android
@wuweijian1997 Please file a new issue using issue template and provide relevant details so that we can address it properly.
This thread has been automatically locked since there has not been any recent activity after it was closed. If you are still experiencing a similar issue, please open a new bug, including the output of flutter doctor -v
and a minimal reproduction of the issue.