isCacheCleared method
Implementation
Future<bool> isCacheCleared() async {
final directory = await getApplicationDocumentsDirectory();
final cacheDir = Directory('${directory.path}/$cacheDirName');
await clearCache();
if (cacheDir.existsSync()) {
List<FileSystemEntity> files = cacheDir.listSync();
return files.isEmpty; // Return true if the cache directory is empty
}
return false; // Return false if the cache directory does not exist or is not empty
}