Search code examples
androidflutterdownloadpath-provider

FileSystemException: Cannot copy file to 'storage/emulated/0/Download/', path = '/data/user/0/com.xx.x/f' (OS Error: Operation not permitted, errno


I'm trying to save my file into Downloads folder but in android path_provider package does not support getDownloadsDirectory so I decided to save manually in /storage/emulated/0/Download but it shows me this error message:

Unhandled Exception: FileSystemException: Cannot copy file to 'storage/emulated/0/Download/filename', path = '/data/user/0/com.xx.x/files/filename.pdf' (OS Error: Operation not permitted, errno = 1)

my permission for storage is already granted using Permission.storage.request() and I've also added

<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"
        />

<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"
        />
<uses-permission android:name="android.permission.MANAGE_EXTERNAL_STORAGE"
       tools:ignore="ScopedStorage" />

but still doesn't work. Anyone willing to help?


Solution

  • it seems that for rename/copy, the OS refused character like : in the name. It was my issue. It's ok on Android 8, but not 10 or 13.

    regards