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();
}
}
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…