What's new
Raw file descriptors
Hand a SAF file to anything that wants a real path or fd — video players, PDF renderers, sqlite — no copy:
final title = await saf.withFileDescriptor(doc.uri, 'r', (fd) async {
return someNativeLib.readMetadata(fd.path); // /proc/self/fd/<fd>
});openFileDescriptor / closeFileDescriptor are also available for manual control. The descriptor is always closed for you with withFileDescriptor — even when your action throws.
Provider thumbnails
thumbnail(uri, width, height, quality) returns provider-generated JPEG bytes (Uint8List?) — perfect for gallery grids with Image.memory, no full-image decode.
Mini file-manager example
cd example && flutter run: pick a folder, browse it with live image thumbnails, tap a file for its details and fd path, write a file back. Verified on physical hardware against a 5,613-file camera roll.
Hardened file layer
- An aborted
writeFileStreamno longer deletes a pre-existing target (overwrite/append) — only documents created by that write are cleaned up. copyTo/moveTonow reject copying a directory into itself or its own subtree.releasePersistedPermissionnow actually releases directory grants taken bypickDirectory.- Picker failures (e.g. no SAF handler on some Android TV/Go builds) no longer wedge all future picks.
openReadSessionno longer leaks the stream when the initial seek fails.- Deprecated legacy
FileTypes; internalmapPlatformExceptionremoved from the public API.
Full changelog: https://github.com/jvoltci/saf/blob/master/CHANGELOG.md
Docs: https://jvoltci.github.io/saf/