I tried to change path of the internal storage file but it could not happen. Then I tried copy that file to another location and delete it from first location. unfortunately, this also did not work.
Here is my error:
[ERROR:flutter/runtime/dart_vm_initializer.cc(41)] Unhandled Exception: FileSystemException: Cannot delete file, path = '/storage/emulated/0/DCIM/Screenshots/Screenshot_20230116-114448.jpg' (OS Error: No such file or directory, errno = 2)
If anyone have idea then it could be helpful. Thank You.
CodePudding user response:
before accessing the storage ask for storage permission with the below code and also you can check this permission package https://pub.dev/packages/permission_handler. Don't forget to add permission in for android and iOS in their respective folder
await Permission.storage.request();
and if you have any other doubt then you can ask it in comments.
CodePudding user response:
If you are in android 10 and above WRITE_EXTERNAL_STORAGE is remove in android native...we can only delete the file that app have write in DCIM or any public directory, if we uninstall the app and reinstall the same app then it won't delete it... You can view the answer and comment of this stackoverflow