Replace flutter_downloader with file_saver_ffi#104
Replace flutter_downloader with file_saver_ffi#104vanvixi wants to merge 1 commit intoNetShareOSS:masterfrom
Conversation
huynguyennovem
left a comment
There was a problem hiding this comment.
Awsome. Thank you for doing this! Overall looks good to me, except two issues:
iosandmacosfile changes don't relate to this work. Could you please revert them and re-commit the change?- After downloading a file, it is no longer possible to open it (please watch the video). I printed the output path and saw that it is something like
content://media/external_primary/file/1000000232now, which seems to be exposed from thefile_saver_ffipackage, doesn't it? Previously, a file was downloaded and stored toAndroidPathProvider.downloadsPath. I also see it'sAndroidSaveLocation.downloadson Android by default in packagefile_saver_ffi. Not sure if these two paths are the same. Could you please check this?
Screen.Recording.2026-03-07.at.17.01.34.mov
b2bc6ee to
1a8d844
Compare
|
@huynguyennovem Thank you for the review! Regarding the iOS and macOS changes:
Regarding the Android open-file issue: You're right that Starting from Android 10 (API 29), apps are required to use Scoped Storage, and direct access to file paths on shared storage via The issue is that |
Replace
flutter_downloaderwithfile_saver_ffifor cross-platform downloadsMotivation
flutter_downloaderworks well on Android/iOS, but its architecture adds significant complexity to the codebase:IsolateNameServerandReceivePortjust to receive download callbacks@pragma("vm:entry-point")static callback and manualIsolateNameServerregistration/cleanup ininitState/disposehttp-based implementation with no progress trackingloadTasksWithRawQueryAll of this makes
ClientWidgethard to understand and maintain.Solution
This PR replaces
flutter_downloaderwithfile_saver_ffi— a cross-platform file saving library that:Stream<SaveProgress>API — callers need zero knowledge of threading or platform internalsKey improvements:
httpimpl)SaveProgressUpdate(double progress)Changes
ClientWidget: RemovedReceivePort,IsolateNameServer,_initDownloadModule(),downloadCallback()static method, and 3 unused imports._downloadStreamListener()is unchanged.DownloadService: Replaced two platform-branched download methods with a singlestartDownloading()usingFileSaver.save(). MIME type detected automatically via the existingmimepackage.DownloadEntity: Removed unusedidandmannerfields; addedprogressfield andcopyWith().FileProvider: Added in-memory_progressMap+getProgress()for granular progress updates without polluting the Hive entity.FileTileClient: Progress indicator now shows determinate progress (0-100%) usingSelector<FileProvider, double>withshouldRebuildto avoid full-list rebuilds on every tick.download_manner.dart,uuiddependency, andandroid_path_provider.Result
The entire download flow — including real-time progress — now works identically on all platforms with significantly less code. Threading and chunk management are handled by
file_saver_ffiinternally; the app just listens to a stream.