Libraries used: https://pub.dev/packages/multi_image_picker, https://pub.dev/packages/flutter_image_compress
I am using multi image picker lib to get multiple images from the gallery. However, before uploading them I want to compress image's size first.
Multiple image picker return List<Asset>
but in flutter_image_compress lib, we can only compress image as a type of File like this:
Future<Uint8List> testCompressFile(File file) async {
var result = await FlutterImageCompress.compressWithFile(
file.absolute.path,
minWidth: 2300,
minHeight: 1500,
quality: 94,
rotate: 90,
);
return result;
}
How can I convert List<Asset>
to List<File>
in order to compress image?
I solved this problem. Please check my full source code here: https://soksereyphon8.medium.com/upload-multiple-images-and-compress-image-in-flutter-62d113a3247a