saf 1.0.3+4 copy "saf: ^1.0.3+4" to clipboard
saf: ^1.0.3+4 copied to clipboard

PlatformAndroid

Flutter plugin that leverages Storage Access Framework (SAF) API to get access and perform the operations on files and folders.

saf

Saf

Saf #

Flutter plugin that leverages Storage Access Framework (SAF) API to get access and perform the operations on files and folders.

Currently supported features #

  • Uses OS default native file explorer
  • Access the hidden folder and files
  • Accessing directories
  • Caching the files inside the app External files directory
  • Syncing the files of some directory with cached one
  • Different default type filtering (media, image, video, audio or any)
  • Support Android

If you have any feature that you want to see in this package, please feel free to issue a suggestion. 🎉

Example App #

Android

Demo

Usage #

To use this plugin, add saf as a dependency in your pubspec.yaml file.

Initiate Saf with instance #

Saf saf = Saf("~/some/path")
copied to clipboard

Directory Permission request

bool? isGranted = await saf.getDirectoryPermission(isDynamic: false);

if (isGranted != null && isGranted) {
  // Perform some file operations
} else {
  // failed to get the permission
}
copied to clipboard

Get the list of all the paths for the Granted Directories


bool? directoriesPath = await saf.getPersistedPermissionDirectories();

copied to clipboard

Get paths of all the files for current directory


List<String>? paths = await saf.getFilesPath(FileType.media);

copied to clipboard

Cache the current directory


bool? isCached = await saf.cache();

if (isCached != null && isCached) {
  // Perform some file operations
} else {
  // failed to cache
}

copied to clipboard

Get the cached files' path for current directory


List<String>? cachedFilesPath = await saf.getCachedFilesPath();

copied to clipboard

Clear cache for the current directory


bool? isClear = await saf.clearCache();

copied to clipboard

Sync the current directory with the cached one


bool? isSynced = await saf.sync();

copied to clipboard

Release the persisted permission for current directory


bool? isReleased = await Saf.releasePersistedPermission();

copied to clipboard

Release the persisted permissions for all the granted directories


await Saf.releasePersistedPermissions();

copied to clipboard

Documentation #

See the Saf Wiki for every detail on about how to install, setup and use it.

Saf Wiki #

  1. Installation
  2. Setup
  3. API
  4. FAQ
  5. Troubleshooting

For full usage details refer to the Wiki above.

Getting Started #

For help getting started with Flutter, view our online documentation.

For help on editing plugin code, view the documentation.

63
likes
140
points
12
downloads

Publisher

verified publisherivehement.com

Weekly Downloads

2024.09.22 - 2025.04.06

Flutter plugin that leverages Storage Access Framework (SAF) API to get access and perform the operations on files and folders.

Repository (GitHub)
View/report issues
Contributing

Documentation

API reference

License

MIT (license)

Dependencies

flutter, permission_handler

More

Packages that depend on saf