removeFromCache function

Future<bool> removeFromCache(
  1. String url, {
  2. bool useCacheRule = false,
})

Implementation

Future<bool> removeFromCache(String url, {bool useCacheRule = false}) async {
  String uId = uid(url);

  try {
    if (useCacheRule) {
      return await DiskCache().evict(uId);
    } else {
      await File(join((await getTemporaryDirectory()).path, 'imagecache', uId))
          .delete();
      return true;
    }
  } catch (e) {
    print(e);
    return false;
  }
}