saf 2.1.0
saf: ^2.1.0 copied to clipboard
Flutter plugin that leverages Storage Access Framework (SAF) API to get access and perform the operations on files and folders.
2.1.0 #
- New:
openFileDescriptor/closeFileDescriptoropen a live file descriptor for a SAF document and expose its/proc/self/fd/<fd>path for native or path-based APIs;withFileDescriptoropens, runs your action, and always closes in afinally. - New:
thumbnail(uri, width, height, quality)returns provider-generated JPEG bytes (Uint8List?), ornullwhen the provider has none. - New:
SafOpenFdmodel (fd,path). - Example: a mini file-manager showcasing the new descriptor and thumbnail APIs.
- Fix: an aborted
writeFileStreamno longer deletes a pre-existing target file (overwrite/append) — only documents created by that write are cleaned up. - Fix:
copyTo/moveTonow reject copying a directory into itself or its own subtree instead of recursing until storage fills. - Fix:
releasePersistedPermissionnow releases directory grants taken bypickDirectory(URI-form mismatch made it a silent no-op). - Fix: picker failures (e.g. no SAF handler on some Android TV/Go builds) no longer leave the plugin stuck rejecting all future picks.
- Fix:
openReadSessionno longer leaks the stream when seeking fails. - Deprecated
FileTypes(legacy 1.x, removed in 3.0.0); internalmapPlatformExceptionis no longer exported.
2.0.1 #
- Documentation and presentation polish. No API or behavior changes.
2.0.0 #
One class for everything SAF. The new Saf class covers pickers,
persisted permissions, file management, recursive walk(), byte/stream
read-write with progress callbacks, and local-file bridging — one focused
API, typed exceptions, no isDir parameters.
BREAKING: the legacy path-based class is renamed LegacySaf
(deprecated, removal in 3.0.0). Its behavior is unchanged — existing code
only needs Saf( → LegacySaf(.
- New:
pickDirectory/pickFile/pickFileswith initial URI and persistable permissions;persistedPermissions()listing. - New:
list(single-cursor, fast),stat,exists,child,mkdirp,delete,rename, recursivecopyTo/moveTowith progress,walk(). - New:
readFileBytes/readFileStream,writeFileBytes, one-callwriteFileStream,copyToLocalFile/pasteLocalFile, andcopyDirToLocal(bulk-copy a granted folder into your app dir — e.g. WhatsApp.Statuses). - New: sealed
SafExceptionhierarchy (permission/not_found/already_exists/io). - Broad support: Dart >=3.0, Flutter >=3.10, Android minSdk 21.