-
Notifications
You must be signed in to change notification settings - Fork 27.7k
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
Android support for content:// uri in the File class. #25659
Comments
That's common that the platform implementation between Android and iOS are different. |
Because you have to check the platform in the dart-code, and read the file differently on different platforms. What is the advantage of Flutter then? After all, this difference can be hidden inside the file management classes. |
@andyduke you can provide it the same way from native to Dart from iOS and Android so that you don't know the difference on the Dart side. |
When a link to a file comes into my dart-code (via a deep link, from the document picker, etc), it is necessary to check if it is a content uri and read it either through the File class or through a plugin. Thus, it is necessary to think about how to read the link to the file in different ways, and only in Android. This kills all the benefits of Flutter as a cross-platform development tool. |
There won't be a |
There is no content uri on iOS, there is an Android only. When you receive a link to a file, you need to check which link it is and write a lot of different code to process it. Since files are a fundamental thing, there will be many such places. Files can be used differently, converted from JSON, passed to the Image class, used when calling other libraries. It’s not always possible to do processing, for example, it’s difficult to pass such a link to the Image class. Therefore, I think it would be correct to hide this Android feature inside the base classes for working with files, otherwise they are not needed at all (since they do not perform their task), let everyone write their own file plug-ins for all platforms - now it looks exactly like that. And it is all the more strange since Flutter and Dart are developed by Google, but for Android you need to use a dirty workaround. |
Someone has made this plugin ? |
You can use this library to get the absolute path that will work with the dart class File |
Good job. Did I understand correctly that for some cases, the file is copied to a directory within the application? |
Yes, that was mainly added to support content URIs that are under the authority of other apps like google photos.
No, you will have to delete the file after you finish using it. |
What about Whatsapp URIs ?
…On Sat, Jun 29, 2019, 00:06 Kasem SAEED ***@***.***> wrote:
You can use this library to get the absolute path that will work with the
dart class File
https://pub.dev/packages/flutter_absolute_path
Good job.
Did I understand correctly that for some cases, the file is copied
<https://github.com/KasemJaffer/flutter_absolute_path/blob/master/android/src/main/kotlin/com/kasem/flutter_absolute_path/FileDirectory.kt#L93>
to a directory within the application?
Will a copy of the file be deleted later?
Yes, that was mainly added to support content URIs that are under the
authority of other apps like google photos.
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<#25659?email_source=notifications&email_token=ABQVAHY4RKMVJ2R7FHM4X2DP4Z4MTA5CNFSM4GLYAKP2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGODY3FECA#issuecomment-506876424>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/ABQVAH2ZMH6SIH2L6F74SLDP4Z4MTANCNFSM4GLYAKPQ>
.
|
Any suggestion on how to get WhatsApp file Audio having an URI like 'content://whatsapp.media.....' ? I have opened this issue in |
The |
Closing, since I suspect it would be closed there as well though, since it's not at all clear how many of the APIs in |
This thread has been automatically locked since there has not been any recent activity after it was closed. If you are still experiencing a similar issue, please open a new bug, including the output of |
Flutter does not support content:// uri in Android. I cannot use such a uri in the File class to read the attached file in Gmail (for example, when opening an attached file from an email through a flutter application via deep linking).
You can write a plugin that will read files at such a URI, but this will not be a cross-platform code, since you will have to remember that in Android, content:// uri files must be read through the plugin, and in iOS via File class.
It would be nice to support this type of uri in the File class on Android.
The text was updated successfully, but these errors were encountered: