简体   繁体   中英

How to control Network caching from my Flutter app?

For example, https://docs.flutter.io/flutter/services/NetworkImage-class.html says that cache headers are ignored. My understanding is iOS has an NSUrlCache on disk and it would be nice to be able to enable that. Similarly, I suspect Android has a disk cache which would be nice to enable.

Can I control Flutter's caching? Should I write my own disk cache/caching strategy in Dart on top of/in-front of NetworkImage?

We do not currently have a good way to do this, unfortunately. You could provide your own ImageProvider similar to NetworkImageProvider that had its own cache and implemented the network semantics correctly. We would certainly accept that as a patch if you contributed it. :-)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM