get method
Retrieves a cached value by key, or null if expired or missing.
Implementation
dynamic get(String key) {
final raw = _cacheBox.get(key);
if (raw == null) return null;
try {
final entry = CacheEntry.fromJson(jsonDecode(raw));
if (entry.expiry.isAfter(DateTime.now())) {
return entry.value;
}
remove(key);
} catch (_) {
remove(key);
}
return null;
}