clearCache static method
Clears all cached notification images.
Useful for:
- Freeing up disk space
- Clearing old/stale images
- Testing/debugging
Example:
await NotificationImageLoader.clearCache();
Implementation
static Future<void> clearCache() async {
if (kIsWeb) return;
try {
final cacheDir = await _getCacheDirectory();
if (await cacheDir.exists()) {
await cacheDir.delete(recursive: true);
logi('Notification image cache cleared');
}
} catch (e, stackTrace) {
loge(e, 'Error clearing notification image cache', stackTrace);
}
}