Flutter :FileSystemException: Directory listing failed, path = '/storage/emulated/0/Android/data' (OS Error: Permission denied, errno = 13) - flutter

i am getting all pdf from device storage but after android 9 it mbile shows different eroors and all are same like exclude path = '/storage/emulated/0/Android/data . So how can i exclude all those path that create run time error

Related

Gallery saver catches (OS Error: File name too long, errno = 36))

I'm trying to save an image to the Android gallery and catch this exception:
FileSystemException (FileSystemException: Cannot open file, path = '/data/user/0/...' (OS Error: File name too long, errno = 36)).
How to solve this problem?

How to read files outside the project's directory

I'm new to flutter,I want to read some files outide the directory of my flutter project,let's say a file located in Desktop folder
here's how I tried
Future<File> _getLocalFile() async {
return File('/Users/xxx/Desktop/test.txt');
}
then I got this error
[ERROR:flutter/lib/ui/ui_dart_state.cc(209)] Unhandled Exception: FileSystemException: Cannot open file, path = '/Users/xxx/Desktop/test.txt' (OS Error: Operation not permitted, errno = 1)
Is there any way I can get the permission to deal with such files?

what is flutter app default path in macos?

Use flutter dev app with macos desktop.
One local file: test1.md
In Dart code, I cann't find local file: test1.md
try
print(readText("test1.md"));
Exception has occurred:
FileSystemException (FileSystemException: Cannot open file, path = 'test1.md' (OS Error: No such file or directory, errno = 2))
print(Directory.current);
Output:
flutter: Directory: '/Users/jiangzhixiang/Library/Containers/com.example.enjoywork/Data'
How to find local file?

OS Error: Access is denied. , errno = 5 in flutter

`Target debug_android_application failed: FileSystemException: Cannot copy file to 'C:\Users\TITYA\flutter_udemy_four\build\app\intermediates\flutter\debug\flutter_assets\assets\food.jpg', path = 'C:\Users\TITYA\flutter_udemy_four\assets\food.jpg' (OS Error: Access is denied.
, errno = 5)
Please help me to solve this problem. Thank`
Run the command you are using in as an admin terminal

"FileSystemException: Cannot open file, path = 'C:\Users\flutter\bin\cache\lockfile' (OS Error: Access is denied

"FileSystemException: Cannot open file, path = 'C:\Users\flutter\bin\cache\lockfile' (OS Error: Access is denied.
This message occurred while flutter doctor command.