clearCache method
Clear all cache
Implementation
Future<void> clearCache() async {
_ensureInitialized();
final cacheDir = Directory(path.join(_baseDirectory!.path, 'Cache'));
if (await cacheDir.exists()) {
await for (final entity in cacheDir.list()) {
if (entity is File) {
await entity.delete();
} else if (entity is Directory) {
await entity.delete(recursive: true);
}
}
_logger.info('Cache cleared');
}
}