Skip to content

saf 2.0.0 — one class for the Storage Access Framework

Choose a tag to compare

@jvoltci jvoltci released this 18 Jul 12:12

One Saf class covers everything SAF — full native create/read/write/update/delete (no dart:io on granted folders), typed errors, streaming with backpressure, recursive walk, progress, and hidden-folder support.

Highlights

  • Pickers + persisted permissions — grant once, reuse across restarts; persistedPermissions() lists grants.
  • File managementlist (fast single-cursor), stat, exists, child, mkdirp, delete, rename, recursive copyTo/moveTo with progress, recursive walk().
  • Read/writereadFileBytes, readFileStream (pull-based, no OOM on huge files), writeFileBytes, one-call writeFileStream.
  • Bridge to local filescopyToLocalFile, pasteLocalFile, and copyDirToLocal (pull a whole granted folder — e.g. WhatsApp .Statuses — into your app dir).
  • Typed errorsSafPermissionException, SafNotFoundException, SafAlreadyExistsException, SafIoException.
  • No isDir params anywhere. Broad support: Dart >=3.0, Flutter >=3.10, minSdk 21.

Breaking

The legacy path-based class is now LegacySaf (deprecated, removed in 3.0.0). Migrate with Saf( -> LegacySaf(. See the README.

Docs & quality

Docs: https://jvoltci.github.io/saf/ · pana 150/150 · verified end-to-end on a physical Android 15 device.

Fixes: #8 #24 #27 #34 #36 #37 #39 #41 (and #31 — docs are back).