'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?
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|