saf 2.0.0 — one class for the Storage Access Framework
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 management —
list(fast single-cursor),stat,exists,child,mkdirp,delete,rename, recursivecopyTo/moveTowith progress, recursivewalk(). - Read/write —
readFileBytes,readFileStream(pull-based, no OOM on huge files),writeFileBytes, one-callwriteFileStream. - Bridge to local files —
copyToLocalFile,pasteLocalFile, andcopyDirToLocal(pull a whole granted folder — e.g. WhatsApp.Statuses— into your app dir). - Typed errors —
SafPermissionException,SafNotFoundException,SafAlreadyExistsException,SafIoException. - No
isDirparams 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).