CacheConfig class

Controls HTTP response caching behaviour for a single request.

CacheConfig(
  isToCache: true,
  isToLoadDataFromCache: true,
  cacheDuration: Duration(hours: 6),
)

Constructors

CacheConfig({bool isToCache = false, Duration cacheDuration = const Duration(days: 3), bool isToLoadDataFromCache = false, bool isToRefresh = false, dynamic additionCallback(bool, bool)?})
const

Properties

additionCallback → dynamic Function(bool, bool)?
Called after the cache-lookup decision is made.
final
cacheDuration Duration
How long cached data is considered fresh. Defaults to 3 days.
final
hashCode int
The hash code for this object.
no setterinherited
isToCache bool
Persist the network response to cache after a successful call.
final
isToLoadDataFromCache bool
Return cached data without hitting the network (when unexpired).
final
isToRefresh bool
Force a fresh network call and overwrite the existing cache entry.
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited