invalidatePattern static method
Delete all entries whose keys start with prefix.
await ApiCache.invalidatePattern('gallery_');
// removes gallery_1, gallery_2, gallery_list, etc.
Implementation
static Future<void> invalidatePattern(String prefix) async {
final allKeys = await storage.keys();
for (final k in allKeys.where((k) => k.startsWith(prefix))) {
await storage.delete(k);
}
}