saf
2.1.2, released 3 months ago by ivehement.com
Access and manage files and folders via Android Storage Access Framework
What it does
Leverages the Android Storage Access Framework (SAF) API to pick directories, persist permissions, perform file management operations, stream large files, and handle file descriptors or thumbnails. It bridges scoped storage restrictions on Android into a unified API.
AI-written summary of version 2.1.2, based on the package's README and metadata. Report an inaccuracy
Use it when
- You need to access external storage or user-selected folders on Android past scoped storage restrictions.
- You want to stream large files or read thumbnails directly from Android storage providers.
- You need to persist user file permissions across app restarts.
Skip it when
- You are building a cross-platform app requiring uniform file pickers on iOS or desktop (Android specific).
- You only need simple media picking like images or videos (use image_picker instead).
Strengths
- Provides a single class facade for complex Android SAF APIs.
- Supports persisted permissions, recursive walks, and file descriptors.
- Typed exceptions for clear error handling.
Weaknesses
- Android platform specific.
- Requires managing URI-based permissions and user prompts.
Setup
- Kind
- Plugin (native code)
- Effort
- Low
- Code generation
- No
- Direct dependencies
- 1
Requires Android configuration since it interacts directly with the Android Storage Access Framework.
import 'package:saf/saf.dart';
final saf = Saf();
final dir = await saf.pickDirectory();
if (dir != null) {
final files = await saf.list(dir.uri);
}Alternatives
Packages that do the same job and could replace saf.
- saf_util
Utility functions for Android's Storage Access Framework (SAF)
69Compare - file_selector_macos
macOS implementation of the file_selector plugin
82Compare - flutter_downloader
Plugin to create and manage background download tasks on Android and iOS.
80Compare - path_provider_android
Android implementation of the path_provider plugin for finding commonly used locations.
79Compare
Works with
Packages commonly used together with saf: ones it builds on, ones built on it, and its own family.