Home > other >  Flutter - Where should I save downloaded files?
Flutter - Where should I save downloaded files?

Time:08-13

I am building a flutter app (iOS/Android/MacOS/Windows/Web) which is able to download files, selected by the user. But where should I save those files? On MacOS/Windows its easy using path_provider and get the path of the downloads folder.

But where should I save the files on the other platforms? The downloads folder would be perfect because the users are able to use those files (.pdf) even without using the app, so the files are not app specific.

CodePudding user response:

If you wish to save in download directory you can use

Directory appDownloadDir = await getDownloadsDirectory();
String appDownloadPath = appDownloadDir.path;

Or

getExternalStorageDirectory()//android
getApplicationDocumentsDirectory()// ios doesnt support access to download folder
  • Related