Reputation: 4110
I am developing a file based application through flutter.
I can create a folder through getApplicationDocumentsDirectory()
which gives the path to write files. But it cannot be seen in the files Explorer
I then created the folder through getExternalStorageDirectory()
, which can be seen in the files explorer
. But I want it to be created in the root.
You may have seen whatsapp folder in the root directory. I also want the same thing. I have tried the following:
Directory('FolderName').create()
But it gives the error saying 'read only os '
Is there a way to do it through flutter ?
Upvotes: 1
Views: 3534
Reputation: 1266
You can do it this way:
String folderName = "My New Downloads";
var path = "storage/emulated/0/$folderName";
await new Directory(path).create();
Upvotes: 6