clearAllCachedImages static method

Future<void> clearAllCachedImages({
  1. bool showLog = true,
})

clearAllCachedImages function clears all cached images. This can be used in scenarios such as logout functionality of your app, so that all cached images corresponding to the user's account is removed.

Implementation

static Future<void> clearAllCachedImages({bool showLog = true}) async {
  _checkInit();
  await _imageKeyBox!.deleteFromDisk();
  await _imageBox!.deleteFromDisk();
  if (showLog) debugPrint('FastCacheImage: All cache cleared.');
  _imageKeyBox = await Hive.openLazyBox(_BoxNames.imagesKeyBox);
  _imageBox = await Hive.openLazyBox(_BoxNames.imagesBox);
}