flutter_cache_manager icon indicating copy to clipboard operation
flutter_cache_manager copied to clipboard

Download Progress as stream

Open ened opened this issue 7 years ago • 16 comments

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.

ened avatar Feb 25 '19 00:02 ened

+1

badboy-tian avatar May 26 '19 07:05 badboy-tian

+1

furkankurt avatar Jun 30 '19 21:06 furkankurt

+1

jimgreer avatar Aug 16 '19 01:08 jimgreer

+2

saviourdog avatar Oct 04 '19 12:10 saviourdog

+1

FCMHUB avatar Oct 23 '19 13:10 FCMHUB

+1

wochen85 avatar Dec 30 '19 02:12 wochen85

+1

gjrjf avatar Jan 11 '20 08:01 gjrjf

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.

suragch avatar Mar 15 '20 06:03 suragch

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 avatar Mar 20 '20 10:03 renefloor

@renefloor Actually, since making that comment I discovered getFile() which also returns a stream. So it seems that this is already available, correct?

suragch avatar Mar 20 '20 10:03 suragch

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 avatar Mar 20 '20 11:03 renefloor

@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.

suragch avatar Mar 21 '20 02:03 suragch

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?

suragch avatar Mar 21 '20 03:03 suragch

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

renefloor avatar Mar 27 '20 08:03 renefloor

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 avatar Apr 20 '20 02:04 suragch

@suragch thanks for mentioning me. I'll close this issue now :)

renefloor avatar Apr 20 '20 05:04 renefloor