Flutter has its own internal cache of images. I need to clear that image cache. How do I do that?
An image service cache represents a snapshot of your image service at one point in time, with one or three bands, and using a specific mosaic method.
Refer to the Flutter docs
/// This is the custom implementation of [ImageCache] where we can override /// the logic. class MyImageCache extends ImageCache { @override void clear() { print('Clearing cache!'); super.clear(); } } class MyWidgetsBinding extends WidgetsFlutterBinding { @override ImageCache createImageCache() => MyImageCache(); } void main() { // The constructor sets global variables. MyWidgetsBinding(); runApp(const MyApp()); } class MyApp extends StatelessWidget { const MyApp({Key? key}) : super(key: key); @override Widget build(BuildContext context) { return Container(); } }
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With