Whether returned file is from cache or just downloaded
💬 Questions and Help
Hi, is there an easy way to check during .getSingleFile() whether the returned file was pulled from the cache, or whether it was just downloaded?
Thank you!
@xJon no way to check file source u need to change the impl in method getSingleFile to change the return type from File to FileInfo
be know this will make breaking changes
u can make a fork from the package and use it
https://github.com/Baseflow/flutter_cache_manager/blob/3bd49b866d9b5e6ce09d2283f0ef97488be97e1d/flutter_cache_manager/lib/src/cache_manager.dart#L74
@renefloor why doesn't getSingleFile return FileInfo? Shouldn't it do so to match other methods?
I think that makes more sense indeed, but it will be a breaking change.
You can also do something like this:
var fileInfo = await DefaultCacheManager()
.getFileStream(url)
.first as
FileInfo;