CacheOptions class

Options to apply to handle request and cache behaviour.

Available extensions

Constructors

CacheOptions.new({CachePolicy policy = CachePolicy.request, List<int> hitCacheOnErrorCodes = const [], bool hitCacheOnNetworkFailure = false, CacheKeyBuilder keyBuilder = defaultCacheKeyBuilder, Duration? maxStale, CachePriority priority = CachePriority.normal, CacheCipher? cipher, bool allowPostMethod = false, required CacheStore? store})
const

Properties

allowPostMethod bool
allow POST method request to be cached.
final
cipher CacheCipher?
Optional method to decrypt/encrypt cache content.
final
hashCode int
The hash code for this object.
no setterinherited
hitCacheOnErrorCodes List<int>
Allows to return previous cached response on given status codes.
final
hitCacheOnNetworkFailure bool
Allows to return previous cached response on network failure (or offline).
final
keyBuilder CacheKeyBuilder
Builds the unique key used for indexing a request in cache. Default to CacheOptions.defaultCacheKeyBuilder
final
maxStale Duration?
Overrides any HTTP directive to delete entry past this duration.
final
policy CachePolicy
Handles behaviour to request backend.
final
priority CachePriority
The priority of a cached value. Ease the clean up if needed.
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
store CacheStore?
Store used for caching data.
final

Methods

copyWith({CachePolicy? policy, List<int>? hitCacheOnErrorCodes, bool? hitCacheOnNetworkFailure, CacheKeyBuilder? keyBuilder, Duration? maxStale, CachePriority? priority, CacheStore? store, CacheCipher? cipher, bool? allowPostMethod}) CacheOptions
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toExtra() Map<String, dynamic>

Available on CacheOptions, provided by the CacheOptionExtension extension

toOptions() → Options

Available on CacheOptions, provided by the CacheOptionExtension extension

toString() String
A string representation of this object.
inherited

Operators

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

Static Methods

defaultCacheKeyBuilder({required Uri url, Map<String, String>? headers}) String
Default cache key builder