saf_stream
4.0.3, released 4 weeks ago by flutter-cavalry.com
Read and write Android Storage Access Framework (SAF) documents.
What it does
Allows Flutter applications to read and write Android SAF DocumentFiles using byte-based APIs, file streams, or custom file streams with skip capabilities. It also supports copying between SAF documents and local files.
AI-written summary of version 4.0.3, based on the package's README and metadata. Report an inaccuracy
Use it when
- You need to read or write files via the Android Storage Access Framework (SAF).
- You need to handle large files using streams on Android.
- You need to copy files between SAF documents and local storage.
Skip it when
- You are building for iOS, macOS, Windows, Linux, or Web (Android-only plugin).
- You only need standard local file paths without SAF requirements.
Strengths
- Supports both byte-based operations and streaming for large files.
- Provides custom file stream options to skip bytes natively and reduce memory usage.
- Performance improvements via JNI calls.
Weaknesses
- Platform-specific to Android.
- Minimum Android API version 21 required.
Setup
- Kind
- Plugin (native code)
- Effort
- Low
- Code generation
- No
- Direct dependencies
- 2
Requires Android API 21 or higher.
import 'dart:convert';
import 'dart:typed_data';
import 'package:saf_stream/saf_stream.dart';
final _safStreamPlugin = SafStream();
Future<void> readFile() async {
Uint8List fileBytes = await _safStreamPlugin.readFileBytes('<SAF file URI>');
}Alternatives
Packages that do the same job and could replace saf_stream.
- pasteboard
Read and write images, files, and text to the system clipboard across platforms.
92Compare - async_zip
A Flutter plugin to asynchronously read and write Zip files.
47Compare
Works with
Packages commonly used together with saf_stream: ones it builds on, ones built on it, and its own family.