flush method

Future<void> flush()

Removes all items from the cache.

This method deletes the entire cache directory and recreates it.

Implementation

Future<void> flush() async {
  if (!isAvailable) return;

  if (await _cacheDirectory!.exists()) {
    await _cacheDirectory!.delete(recursive: true);
  }
  await _cacheDirectory!.create(recursive: true);
}