4

Info:

  1. Package: image_picker plugin for flutter, version 0.6.3+1
  2. Android build only, no IOS

Problem:

This is my method to pick an image:

  Future<void> pickImage(ImageSource source) async {
    File selected = await ImagePicker.pickImage(source: source);
    print(selected?.path);
    imageFilePath = selected?.path ?? imageFilePath;
  }

=> When using ImageSource.gallery, when choosing a picture which is not in cache, 'selected.path' prints null. When selecting a picture which is in cache, it does retrieve it, 'selected.path' prints:

/data/user/0/be.etnic.parrainage_mcf/cache/image_picker2517179621202627006.jpg

Anyone knows what causes this problem and how I can solve it?

Sidenotes:

  1. I can also pick an image by making a picture directly with ImageSource.camera, this doesn't give me any problems.
  2. I'm not 100% sure that the selected pictures that return null are not in cache, but the pictures that do return correctly from choosing from the ImageSource.gallery all come from that cache-folder
  3. I don't have any permissions set in my AndroidManifest.xml (other than Internet permission)
2
  • 1
    I dont get the fact that bugs are reported on stackoverflow and how to questions are asked in github issues :) Commented Apr 5, 2021 at 11:50
  • I am also facing the issue after adding android:requestLegacyExternalStorage="true" also, is there a solution to that? Commented Apr 29, 2021 at 16:44

1 Answer 1

4

Based on this link https://github.com/flutter/flutter/issues/41459#issuecomment-563986851, following should solve the problem:

android:requestLegacyExternalStorage="true" 
Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.