Image picker / file picker packages don't behave as expected on Android 14

172 Views Asked by At

I have a flutter web application with multiple file adding functionality. It works as expected under previous versions of Android, and under IOS. But not since I updated Android to version 14...

A simple button 'Pick files' was offering the choice between camera or gallery. But now, it only opens the gallery...

Here is how i'm picking my files :

_pickImage() async {
    try {
      FilePickerResult? result = await FilePicker.platform.pickFiles(
          type: FileType.image, allowMultiple: true, allowCompression: true);
      if (result != null && result.files.isNotEmpty) {
        for (int i = 0; i < result.files.length; i++) {
          PlatformFile file = result.files[i];
          Uint8List? imageBytes = file.bytes!;
          Uint8List? compressedImage = await compressImage(imageBytes);
          imgList.add(compressedImage);
        
        }
        setState(() {});
      }
    } catch (e) {
      throw Exception('Picking images failed : $e');
    }
  }

I tried updating File_Picker. I also tried other packages like image_picker... It's still the same..

I don't know if this is a "bug" or a "intentional" change from Android??

0

There are 0 best solutions below