1

Flutter , Dart

I am using file_picker with allowMultiple: true as parameter , but couldn't find a parameter for limiting the number of maximum files which user gonna pick from gallery

Is this possible?, if not How can I do it ?

great regards

 final  result = await FilePicker.platform.pickFiles(allowMultiple: true ,  type: FileType.custom , allowedExtensions: ['jpg','png','mp4'], );
Jack
  • 161
  • 1
  • 16
  • I think there is now such parameter right now to tell the max file to select. till this date. you may can limit the number of files from the list after the user select "n" files. – Alan Bosco Nov 24 '21 at 06:24
  • 1
    thanks Alan , since it inappropriate to make user select first then limit , so i decided to use photo_manager its more better than file picker anyway – Jack Nov 24 '21 at 11:25

1 Answers1

0

I found another package that can limit the number of maximum files to pick from gallery. The limit can be set using param maxImages https://pub.dev/packages/multi_image_picker2.

final pickedAssets = await MultiImagePicker.pickImages(
  maxImages: 30,
);

Or this package, using param maxAssets https://pub.dev/packages/wechat_assets_picker

final pickedAssets = await AssetPicker.pickAssets(
  context,
  pickerConfig: AssetPickerConfig(
    maxAssets: 30,
  ),
);
Ivone Djaja
  • 477
  • 6
  • 13
  • 1
    Your answer could be improved with additional supporting information. Please [edit] to add further details, such as citations or documentation, so that others can confirm that your answer is correct. You can find more information on how to write good answers [in the help center](/help/how-to-answer). – Community Apr 12 '22 at 07:13