getIfNotExpired static method

dynamic getIfNotExpired(
  1. String key
)

Implementation

static dynamic getIfNotExpired(String key) {
  final String expiryKey = "_expiry_$key";
  final int? expiryTime = _sp.getInt(expiryKey);
  if (expiryTime != null && DateTime.now().millisecondsSinceEpoch > expiryTime) {
    remove(key);
    remove(expiryKey);
    return null;
  }
  return _sp.get(key);
}