pickMultiImage method

Future<List<XFile>> pickMultiImage({
  1. double? maxWidth,
  2. double? maxHeight,
  3. int? imageQuality,
  4. bool requestFullMetadata = true,
})

Returns a List<XFile> object wrapping the images that were picked.

The returned List<XFile> is intended to be used within a single app session. Do not save the file path and use it across sessions.

Where iOS supports HEIC images, Android 8 and below doesn't. Android 9 and above only support HEIC images if used in addition to a size modification, of which the usage is explained below.

This method is not supported in iOS versions lower than 14.

If specified, the images will be at most maxWidth wide and maxHeight tall. Otherwise the images will be returned at it's original width and height.

The imageQuality argument modifies the quality of the images, ranging from 0-100 where 100 is the original/max quality. If imageQuality is null, the images with the original quality will be returned. Compression is only supported for certain image types such as JPEG and on Android PNG and WebP, too. If compression is not supported for the image that is picked, a warning message will be logged.

Use requestFullMetadata (defaults to true) to control how much additional information the plugin tries to get. If requestFullMetadata is set to true, the plugin tries to get the full image metadata which may require extra permission requests on some platforms, such as Photo Library Usage permission on iOS.

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), plugin activity could not be allocated (Android only) or due to an unknown error.

See also pickImage to allow users to only pick a single image.

Implementation

Future<List<XFile>> pickMultiImage({
  double? maxWidth,
  double? maxHeight,
  int? imageQuality,
  bool requestFullMetadata = true,
}) {
  final ImageOptions imageOptions = ImageOptions.createAndValidate(
    maxWidth: maxWidth,
    maxHeight: maxHeight,
    imageQuality: imageQuality,
    requestFullMetadata: requestFullMetadata,
  );

  return platform.getMultiImageWithOptions(
    options: MultiImagePickerOptions(
      imageOptions: imageOptions,
    ),
  );
}