storageClearByDirPath method
Clears all files in a specific directory path from the disk cache.
Also removes corresponding entries from the cache.
Implementation
Future<void> storageClearByDirPath(String dirPath) async {
await _storageInit();
final dir = Directory(dirPath);
if (!await dir.exists()) return;
final files = dir.listSync(recursive: true);
for (FileSystemEntity entity in files) {
final stat = await entity.stat();
if (stat.type == FileSystemEntityType.file) {
String filePath = entity.path;
await entity.delete(recursive: true);
await storageRemove(filePath);
}
}
await dir.delete(recursive: true);
}