New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support for Content:// Uri to access files on shared storage #147037
Support for Content:// Uri to access files on shared storage #147037
Comments
I thought 🤔🤔🤔... |
It's better to let them come up with solution from scratch. They know better what they have under the hood and how things can be added. |
There is a package named uri_content which enables you to open an URI as a If we say this fixes the problem enough. Now would by any package requesting or providing |
…bliged me to change everything at once. Waiting to see how flutter/flutter#147037 and miguelpruivo/flutter_file_picker#561 do before posting 1.4.0
…bliged me to change everything at once. Waiting to see how flutter/flutter#147037 and miguelpruivo/flutter_file_picker#561 do before posting 1.4.0
We have considered adding |
Also, a doc with relevant discussion: https://docs.google.com/document/d/12pJDtl0yubyc68UqKo2hQ7XJwv86_ixCjNemQ7ENCBQ/edit#heading=h.ebkwt1wlot63 |
Adding Android support to cross_file would certainly work, only how would cross_file get the data? Like I've said uri_content uses a local server to transfer the data, but I find this method to not be good enough for multiple reasons. |
Not sure why this has a 'dependency:dart' label, based on the conversation in dart-lang/sdk#54878 the conclusion was to not treat these a File objects. |
This comment was marked as off-topic.
This comment was marked as off-topic.
I want to work on this as I find this feature important for my use case. My question is who will have to implement the way to transfer the data from the native side to Dart? If we make cross_file able to take URIs as inputs (or anything) but then will cross_file transfer the data or the package (or app) who constructed the This makes two options:
I personally prefer that we implement the second method as it would enable less duplicate code from other packages using If we opt for the second option I would like to have multiple ways to transfer the data available. My idea would be that we have the main package which wouldn't change and for example two other packages, one named If what I am saying is possible, I would work first on the platform interface approach, then as I find the JNI approach way more efficient (if it is possible, I haven't found any implementation for Java |
I would expect that
If
Having a single package and changing its internal implementation details later would also allow that, but without the overhead of managing two packages. |
Currently Here is the first design document for the feature (I am not entirely sure of where I have also made a draft of what |
I have evaluated both options from my document and found the second more appealing: I have worked on option 2 and looks way better ( |
Use case
Content:// Uri is now the standard method for referencing files on android. But there is no direct way of processing Content:// Uri in Flutter/Dart. Currently, we can process File:// Uri and direct paths to a file but post Android R, it is practically useless.
This feature is a most urgent and must have requirement in Flutter.
Proposal
The current method of processing content based Uri is to go via a chain of Kotlin or java methods to **create a copy of the original file in app cache, which can be referenced with File:// Uri **. Or use a third party plugin(uri_to_file) on pub.dev which uses the same long winded kotlin route to do the same, creates a copy of the file in cache and lacks in some features. Not feasible for an app scanning and processing large files on local shared storage.
Third party plugins may or may not be maintained properly and may be lacking/buggy.
Flutter being a Google initiative, it is a given that a core Android functionality must be a part of Flutter too especially when the said functionality is being enforced in Android by Google itself. Otherwise, what's the point of using Flutter if we have to route through kotlin or java code for even basic features?
This feature is a most urgent and must have requirement in Flutter.
The text was updated successfully, but these errors were encountered: