evict method

  1. @override
Future<void> evict({
  1. required String key,
})
override

Removes the file from the cache.

Implementation

@override
Future<void> evict({required String key}) async {
  Directory tempDir = await getTemporaryDirectory();

  String tempPath = tempDir.path;
  String base64Key = base64.encode(utf8.encode(key));

  File cacheDetailsFile = File('$tempPath/$base64Key.json');
  File cacheContentFile = File('$tempPath/$base64Key.bin');

  if(cacheDetailsFile.existsSync()) {
    cacheDetailsFile.deleteSync();
  }

  if(cacheContentFile.existsSync()) {
    cacheContentFile.deleteSync();
  }

}