delete method

  1. @override
Future<void> delete(
  1. String key
)
override

Removes the entry associated with the key from the cache.

Does nothing if the key is not found.

Implementation

@override
Future<void> delete(String key) async {
  final cache = await getApplicationCacheDirectory();
  final filePathBytes = utf8.encode(key);
  final filePath = sha256.convert(filePathBytes).toString();
  final file = File('${cache.path}/cross_cache/$filePath');

  if (await file.exists()) {
    await file.delete();
  }
}