saf 1.0.1+1 copy "saf: ^1.0.1+1" to clipboard
saf: ^1.0.1+1 copied to clipboard

outdated

A package that allows you to use the native file explorer and make it simple for users to get access for the documents, images, and other files across the directories on the go.

saf

Saf CI pipeline status

Saf #

A package that allows you to use the native file explorer and make it simple for users to get access for the documents, images, and other files across the directories on the go.

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. 🎉

Compatibility Chart #

API Android iOS Windows linux macOS
getDirectoryPermission()
getFilesPath()
getCachedFilesPath()
cache()
singleCache()
clearCache()
syncWithCacheDir()
getPersistedPermissionDirectories()
releasePersistedPermissions()

See the API section of the Saf Wiki or the official API reference on pub.dev for further details.

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

Usage #

Quick simple usage example:

Initiate Saf with instance #

Saf saf = Saf(directoryPath: "~/some/path")

Directory Permission request

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

if (isGranted != null) {
  // Perform some file operations
} else {
  // User canceled the native explorer
}

Get paths of all the files of granted directory

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

Cache the granted directory

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

Get the cached files' path

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

Cache a single file of the granted directory

String? path = await saf.singleCache(filePath: "~/some/path/file.type");

Clear cache of the granted directory

bool? isClear = await saf.clearCache();

Sync the cached directory with the granted directory

bool? isSynced = await saf.syncWithCacheDirectory();

Release the persisted permission for current granted directory

bool? isReleased = await saf.releasePersistedPermission();

Get the list of all the granted directory paths with persisted permissions

List<String>? paths = await Saf.getPersistedPermissionDirectories();
// Note: it is a static method

Release the persisted permissions for all granted the directories

bool? isReleased = await Saf.releasePersistedPermissions();
// Note: it is a static method

For full usage details refer to the Wiki above.

Example App #

Android

Demo

Getting Started #

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

For help on editing plugin code, view the documentation.

51
likes
0
pub points
88%
popularity

Publisher

verified publisherivehement.com

A package that allows you to use the native file explorer and make it simple for users to get access for the documents, images, and other files across the directories on the go.

Repository (GitHub)
View/report issues

License

unknown (LICENSE)

Dependencies

flutter, permission_handler

More

Packages that depend on saf