pick static method

Future<List<CloudMediaItem>> pick({
  1. BuildContext? context,
  2. CloudMediaType type = CloudMediaType.image,
  3. int maxCount = 1,
  4. bool enableEditing = false,
  5. bool enableBackgroundRemoval = false,
  6. bool showPreview = false,
  7. String? folder,
  8. String? subFolder,
  9. CompressionProfile? compressionProfile,
})

Pick one or more media files from the device.

// Simple image pick
final items = await CloudMedia.pick(context: context);

// Product image with editing, preview, custom folder, compression profile
final items = await CloudMedia.pick(
  context: context,
  type: CloudMediaType.image,
  enableEditing: true,
  showPreview: true,
  folder: 'products',
  subFolder: productId,
  compressionProfile: CompressionProfile.product,
);

// Background removal
final items = await CloudMedia.pick(
  context: context,
  enableBackgroundRemoval: true,
);

If showPreview is true, the user sees a review screen after picking and can confirm or cancel before the upload begins.

If compressionProfile is set it overrides the CloudMediaConfig quality and thumbnail size for this pick only.

Storage path layout: users/{uid}/media/{folder}/{subFolder}/{mediaId}/{fileName}

Implementation

static Future<List<CloudMediaItem>> pick({
  BuildContext? context,
  CloudMediaType type = CloudMediaType.image,
  int maxCount = 1,
  bool enableEditing = false,
  bool enableBackgroundRemoval = false,
  bool showPreview = false,
  String? folder,
  String? subFolder,
  CompressionProfile? compressionProfile,
}) async {
  _ensure();
  return _provider!.pickMedia(
    type: type,
    context: context,
    maxCount: maxCount,
    enableEditing: enableEditing,
    enableBackgroundRemoval: enableBackgroundRemoval,
    showPreview: showPreview,
    folder: folder,
    subFolder: subFolder,
    compressionProfile: compressionProfile,
  );
}