Repository navigation
[path_provider] getDownloadsDirectory() doesn't work for iOS and Android. #93198
Description
Activity
- changed the title
[-][path_provider] getDownloadsDirectory() should work for iOS and Android too.[/-][+][path_provider] getDownloadsDirectory() doesn't work for iOS and Android.[/+]on Nov 6, 2021 - addedin triagePresently being triaged by the triage teamPresently being triaged by the triage team
on Nov 8, 2021 The method seems to be only supported on desktop platforms such as macOS. If you use that method, you'll see a message something like:
Functionality only available on macOS.
The documentation also says that, for mobile platform, there's no equivalent path exists and hence the limitation.- addedwaiting for responseThe Flutter team cannot make further progress on this issue until the original reporter respondsThe Flutter team cannot make further progress on this issue until the original reporter responds
on Nov 8, 2021 I'm not sure about iOS, but Android definitely does have a downloads folder, whose path is obtainable with:
Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_DOWNLOADS).getAbsolutePath();I think this should be added to the path_provider_android plugin (I can make a PR if it will be considered for inclusion)
Reacted by Illya Ike, Htet Lynn Htun, Florent, Steve, Luke Hutchison, Bruno Viana de Siqueira and fqingyangI'm not sure about iOS, but Android definitely does have a downloads folder, whose path is obtainable with: Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_DOWNLOADS).getAbsolutePath();
I think this should be added to the path_provider_android plugin (I can make a PR if it will be considered for inclusion)
I think this sounds good even if there is no iOS equivalent.
- removedwaiting for responseThe Flutter team cannot make further progress on this issue until the original reporter respondsThe Flutter team cannot make further progress on this issue until the original reporter responds
on Nov 24, 2021 Keeping it open for further insights from the team. @guillermin Feel free to submit the PR.
- addedp: path_providerPlugin that provides resolved paths to some platform directoriesPlugin that provides resolved paths to some platform directoriesplatform-androidAndroid applications specificallyAndroid applications specificallyand removedin triagePresently being triaged by the triage teamPresently being triaged by the triage team
on Nov 29, 2021 I just submitted PR flutter-team-archive/plugins#4559 with this change.
12 remaining items
- addedteam-ecosystemOwned by Ecosystem teamOwned by Ecosystem teamtriaged-ecosystemTriaged by Ecosystem teamTriaged by Ecosystem team
on Jul 8, 2023 If
Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_DOWNLOADS)is deprecated, Is there any other way to achieve this in Android?If
Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_DOWNLOADS)is deprecated, Is there any other way to achieve this in Android?Please see my comment above.
I have submitted a PR, please have a look: flutter/packages#4708
Reacted by Aleksandr Sergeev- added a commit that references this issue
on Aug 30, 2023 - addedr: fixedIssue is closed as already fixed in a newer versionIssue is closed as already fixed in a newer version
on Aug 31, 2023 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 doctor -vand a minimal reproduction of the issue.- locked as resolved and limited conversation to collaborators
on Sep 14, 2023
Currently getDownloadsDirectory() has the following documentation:
/// Path to the directory where downloaded files can be stored.
/// This is typically only relevant on desktop operating systems.
///
/// On Android and on iOS, this function throws an [UnsupportedError] as no equivalent
/// path exists.
It isn't quite clear why this API can't return paths to iOS' and Android's Downloads folders? I think both has equivalent folders. Am I missing something?