get method
Retrieves the CacheItem associated with the given key
.
Returns null
if no value is found for the given key
.
Throws a CacheException if there is an error retrieving the data.
Implementation
@override
Future<CacheItem<dynamic>?> get(String key) async {
final dynamic storedValue = _cache[key];
if (storedValue == null) {
return null;
}
if (enableEncryption) {
final decryptedValue = _decrypt(storedValue);
return CacheItem.fromJson(jsonDecode(decryptedValue));
} else {
return storedValue as CacheItem<dynamic>?;
}
}