u/incredible_zayed

file_saver 0.4.0 — streaming saves, and a memory-efficient downloadLink for large files
▲ 7 r/FlutterBeginner+1 crossposts

file_saver 0.4.0 — streaming saves, and a memory-efficient downloadLink for large files

Just shipped 0.4.0 of file_saver. The package has been around a while but had one annoying limitation — every save loaded the full payload into Dart memory first. Fine for small files, painful for anything large.

This release fixes that and a bunch of other stuff that's been sitting in the issue tracker.

New APIs:

  • saveAsStream(Stream<List<int>>) — pipes straight to a temp file, then to the save dialog. Never touches the Dart heap.
  • saveLinkAsStream(LinkDetails) — same idea but for authenticated URL downloads, with header support.
  • downloadLink — hands the URL off to the browser on web, and to Android's native DownloadManager. Zero bytes through your isolate.

Other notable changes:

  • Swift Package Manager support for iOS and macOS
  • Path traversal hardening on Android
  • Android writes moved off the main thread (no more frame drops on large saves)
  • macOS save cancellation no longer hangs the platform call
  • Windows invalid filename validation
  • Native filePath copying on iOS/macOS/Windows — no more reading a file just to save it elsewhere
  • Android Gradle/Kotlin/JVM/SDK bumped to current

Repo: https://github.com/incrediblezayed/file_saver Pub: https://pub.dev/packages/file_saver

Bug reports and PRs welcome — most of what's in this release came from people filing issues.

u/incredible_zayed — 6 days ago