Skip to content
pubscout

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.

WASM-ready
$ flutter pub add file_saver_ffi
Source repository

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.

  • file_saver

    Save files from bytes, paths, streams, and URLs across Android, iOS, Web, Windows, macOS, and Linux.

  • flutter_file_saver

    Save files to the device using native save dialogs in Flutter.

  • gal

    Save images and videos to the device gallery with a single call and built‑in permission handling.

Works with

Packages commonly used together with file_saver_ffi: ones it builds on, ones built on it, and its own family.