简体   繁体   中英

Flutter file_picker compress image quality

Is there a way to change the quality of an image on file_picker package?

Here is my code:

void pickMedia() async {
    FilePickerResult? result = await FilePicker.platform.pickFiles(
      type: FileType.image,
    );
    if(result == null) return;

    PlatformFile? file = result.files.first;

    viewFile(file);
  }

Any solutions?

use lib image_picker: link: https://pub.dev/packages/image_picker

Code:

final result = await ImagePicker().pickImage(source: ImageSource.gallery, imageQuality: yourQuality);

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM