clearCache method

Future<void> clearCache()

Implementation

Future<void> clearCache() async {
  // Copy the keys before clearing: once the map is empty there is nothing
  // left to delete from storage.
  final keys = _cache.keys.toList();
  _cache.clear();
  // There is no built-in method to deleteAll from SharedPreferences, so:
  for (final key in keys) {
    await SecureStorage.clearSecureData(key);
  }
}