file_saver_ffi
0.12.0, released 2 weeks ago by v4g.space
Save any file type to device storage, gallery, or a user‑chosen folder with progress and conflict handling.
What it does
This plugin writes bytes to the local file system or gallery on mobile, desktop, and web. It supports native FFI/JNI for high performance and provides real‑time progress updates, cancellation, and conflict resolution.
AI-written summary of version 0.12.0, based on the package's README and metadata. Report an inaccuracy
Use it when
- You need to download or generate a file and store it locally or in the gallery.
- You require progress feedback or cancellation for large files.
- You need cross‑platform support (Android, iOS, macOS, Windows, Linux, Web).
Skip it when
- You only need simple file I/O that can be handled by dart:io or path_provider.
- You are targeting a single platform and prefer a minimal dependency footprint.
Strengths
- Native performance via FFI/JNI, no method channel overhead.
- Comprehensive progress and conflict handling.
- Supports web download via anchor or File System Access API.
- Keeps directory handles across restarts on all platforms.
Weaknesses
- Requires platform‑specific configuration (permissions, entitlements, FileProvider).
- Large dependency tree (ffi, jni, path_provider_windows, dir_picker).
- Web support limited to browsers that allow File System Access API.
Setup
- Kind
- Plugin (native code)
- Effort
- Medium
- Code generation
- No
- Direct dependencies
- 6
Add required permissions in AndroidManifest (WRITE_EXTERNAL_STORAGE, MANAGE_EXTERNAL_STORAGE), iOS Info.plist (NSPhotoLibraryAddUsageDescription, etc.), macOS entitlements for sandboxed apps, and optionally a FileProvider for file:// URIs. No build_runner needed.
import 'package:file_saver_ffi/file_saver_ffi.dart';
final bytes = await fetchBytes();
await FileSaver.saveAsAsync(bytes, 'image.png', location: PathLocation('Pictures'));Alternatives
Packages that do the same job and could replace file_saver_ffi.
- flutter_downloader
Plugin to create and manage background download tasks on Android and iOS.
80Compare - file_saver
Save files from bytes, paths, streams, and URLs across Android, iOS, Web, Windows, macOS, and Linux.
87Compare - flutter_file_saver
Save files to the device using native save dialogs in Flutter.
69Compare - gal
Save images and videos to the device gallery with a single call and built‑in permission handling.
94Compare
Works with
Packages commonly used together with file_saver_ffi: ones it builds on, ones built on it, and its own family.
- webfile_saver_ffi depends on itLightweight bindings for browser APIs via JS interop
- ffifile_saver_ffi depends on itUtilities for working with Foreign Function Interface (FFI) code in Dart.
- jnifile_saver_ffi depends on itProvides Dart/Flutter bindings to call native Java code via JNI.
- path_provider_windowsfile_saver_ffi depends on itWindows implementation of the path_provider plugin
- dir_pickerfile_saver_ffi depends on itPick directories and list file system entries across Android, iOS, macOS, Windows, Linux, and Web.