Open bradyt opened 2 years ago
@hpoul I'd like this feature too Something like this
FilePickerResult? result = await FilePicker.platform.pickFiles(
type: FileType.custom,
allowedExtensions: ['jpg', 'pdf', 'doc'],
);
Want to know if it would be okey if I send a PR about this feature?
I have the following diffs on a fork:
The Android implementation, for
"text/plain", "application/octet-stream"
seems to work for users to select files such asledger.dat
,hledger.journal
, orledger.txt
. For iOS I think I only got it to work for files likeledger.txt
.My reason for limiting what files can be picked, is especially in apps where user can write to file, I don't want them to inadvertently corrupt a non text file somehow, such as
wedding.jpg
, orcar-deed.pdf
.I am hoping something can be implemented at
file_picker_writable
, that would cover my usecase, and potentially others'.I imagine the difficulty is in generalizing this from my usecase above, of something like plain text on iOS and Android, since each platform may cover a notion like MIME types or file extensions with a different approach in the exposed API. And this is just with iOS and Android, I imagine the problem gets more difficult as we discover what the different APIs will be on other platforms. But iOS and Android may be the most difficult cases, since we might imagine desktops expose more aspects of a file in an API, than do mobile OSes.
I completely acknowledge that the author has priorities, that the package is working great, and it is not difficult to maintain my changes on a fork.