Search code examples
androidflutterdartstorage-access-framework

Is there a way to access Android Storage Access Framwork (SAF) from Dart?


I am trying to write a notepad app using Flutter, which will save all the notes in a user selected folder.
So that it can be synced using something like Syncthing.
It seems that since Android 10, this is not possible using the normal File API in Dart.
Is there any way to access the new SAF API from Dart?


Solution

  • After the change in Security policy for Android 9 or above. It is recommended to use the Storage Access Framework (SAF) API option to get access to storage (basic).

    You can simply achieve that task using the flutter package called saf. You can search in the www.pub.dev package directory.

    It basically gives you all the storage access framework API native implementation to the dart side. It opens the native OS file explorer then the user can grant permission of any particular directory and get access to perform some operations on it.