On Android I was able to download a pdf file inside the Downloads folder using the package downloads_path_provider
, but on IOS I got an error using this package.
If I use getApplicationDocumentsDirectory()
I get the path: /var/mobile/Containers/Data/Application/EBB52CAB-7783-489A-B9C4-4BB7A093B8C3/Documents
I want to put the download file inside the Files of an iphone
Show activity on this post. then use these 2 packages: permission_handler to request storage permission. downloads_path_provider to save the file in downloads directory.
you should use Path Provider instead for accessing more than just download directory on devices, it's official flutter plugin and it's easy to use.
For accessing Document directory on storage using the Path Provider
use following:
Directory documents = await getApplicationDocumentsDirectory();
this will allow you to store files in the document storage, you might need to add permission for accessing storage.
For android use :
Directory documents = await getExternalStorageDirectory();
Keep in mind that both of the above directories are visible to user.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With