clearMemoryImageCache function Null safety

void clearMemoryImageCache(
  1. [String? name]
)

clear all of image in memory

Implementation

void clearMemoryImageCache([String? name]) {
  if (name != null) {
    if (imageCaches.containsKey(name)) {
      imageCaches[name]!.clear();
      imageCaches[name]!.clearLiveImages();
      imageCaches.remove(name);
    }
  } else {
    PaintingBinding.instance?.imageCache?.clear();
    PaintingBinding.instance?.imageCache?.clearLiveImages();
  }
}