Download Progress as stream
My current project features the download of somewhat large files (20~30mb) which require the display of such elements.
It would be great if I can retrieve the download progress in a Stream to drive progress bars or other user interface elements.
+1
+1
+1
+2
+1
+1
+1
This issue was opened over a year ago. Still no response? That's unfortunate because it means I may have to abandon flutter_cache_manager.
I'm working on improving the library. I guess this PR will make it easier to accomplish: https://github.com/Baseflow/flutter_cache_manager/pull/148. It makes the downloaded content available as a stream instead of a complete body. @suragch feel free to contribute.
@renefloor Actually, since making that comment I discovered getFile() which also returns a stream. So it seems that this is already available, correct?
No, getFile() doens't return a file as a stream, but it returns a stream of files.
When the file is in the cache, but outdated, it first returns the cached file and then tries to update the cached files. When successful it also returns the updated file. In that way it makes sure the file is quickly returned, but when outdated the users also gets the updated file.
@renefloor Thanks for that comment. That saved me a lot of time. I had misunderstood the usage of that method and was in the process of integrating it into my application.
I'm willing to consider contributing to #148 depending on the time frame and what needs to be done. How far away are you from something that would allow downloading content as a stream? What exactly would you like help on?
Currently the whole proces of saving the file to storage happens in the webhelper. I think that should first be moved out of there, because webhelper should only manage the download and return the bytestream, and I think the cachemanager or the cachestore should handle the saving and then there we should implement the logic of proces. This commit at least makes the total size of the content available: https://github.com/Baseflow/flutter_cache_manager/pull/153/commits/a6ab372b746052d8e08b1c5c6746dc4f26e0b444
This issue appears to be solved by version 1.2.0. That was a great update! Tested and working on Android and iOS. Thank you, @renefloor
@suragch thanks for mentioning me. I'll close this issue now :)