getExpiryForAccess method Null safety

  1. @override
Duration getExpiryForAccess()
override

Gets the Duration before an accessed CacheEntry is considered expired.

This method is called by a caching implementation after a CacheEntry is accessed to determine the Duration before an entry expires. If a Duration.zero is returned a CacheEntry will be considered immediately expired. Returning null will result in no change to the previously understood expiry Duration

Returns the new Duration before an accessed entry expires

Implementation

@override
Duration getExpiryForAccess() {
  // When a cache entry is accessed, we return the specified expiry duration,
  // ignoring the current expiry duration
  return _expiryDuration;
}