How to control Network caching from my Flutter app?

774

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. :-)

Share:
774
Eric Seidel
Author by

Eric Seidel

I manage the flutter.io project at Google.

Updated on December 02, 2022

Comments

  • Eric Seidel
    Eric Seidel over 1 year

    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?