I want to pick files from storage using flutter, but in all libraries the picked file writes to cache immediately and returns the cached URL (/data/data/package/cache...). Sometimes it's OK, but in case of multiple files and large sized files this is not acceptable. I have tried with image_picker,file_picker etc. Is there anything I am missing or any other libraries that can satisfy my requirement? This is happening while testing in android. I didn't test with iOS.
Asked
Active
Viewed 2,167 times
0
-
I do not believe that a file picker would copy the selected files. – blackapps Sep 21 '20 at 06:51
-
lib versions: image_picker: ^0.6.7+8 file_picker: ^2.0.0 – Bibin KJ Sep 21 '20 at 07:22
2 Answers
0
Use clearTemporaryFiles() method or pick files library below 2.0.0. From version 2.0.0 every file is cached on Android platform.

Kubus
- 1
0
I have found this method to overcome this
import 'package:path_provider/path_provider.dart';
final directory = await getTemporaryDirectory();
directory.delete(recursive: true);
final result = await FilePicker.platform.pickFiles();
......
and your rest of the code

Hashir Aslam
- 1
- 2