CacheResponse class

Response representation from cache store.

Constructors

CacheResponse({required CacheControl cacheControl, required List<int>? content, required DateTime? date, required String? eTag, required DateTime? expires, required List<int>? headers, required String key, required String? lastModified, required DateTime? maxStale, required CachePriority priority, required DateTime requestDate, required DateTime responseDate, required String url})

Properties

cacheControl CacheControl
Response Cache-control header
final
content List<int>?
Response body
getter/setter pair
date DateTime?
Response Date header
final
eTag String?
ETag header
final
expires DateTime?
Expires header
final
hashCode int
The hash code for this object.
no setterinherited
headers List<int>?
Response headers
getter/setter pair
key String
Key used by store
final
lastModified String?
Last-modified header
final
maxStale DateTime?
Max stale expiry
final
priority CachePriority
Cache priority
final
requestDate DateTime
Absolute date representing date/time when request has been sent
final
responseDate DateTime
Absolute date representing date/time when response has been received
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
url String
Initial request URL
final

Methods

copyWith({CacheControl? cacheControl, List<int>? content, DateTime? date, String? eTag, DateTime? expires, List<int>? headers, String? key, String? lastModified, DateTime? maxStale, CachePriority? priority, DateTime? requestDate, DateTime? responseDate, String? url}) CacheResponse
getHeaders() Headers
isExpired(CacheControl rqCacheCtrl) bool
Checks if response is expired.
isStaled() bool
Checks if response is staled from maxStale option.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
readContent(CacheOptions options) Future<CacheResponse>
toResponse(RequestOptions options, {bool fromNetwork = false}) Response
toString() String
A string representation of this object.
inherited
writeContent(CacheOptions options, {Response? response}) Future<CacheResponse>

Operators

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

Static Methods

fromResponse({required String key, required CacheOptions options, required Response response}) Future<CacheResponse>

Constants

cacheKey → const String
Cache key available in Response
fromNetwork → const String
Available in Response if coming from network.
requestSentDate → const String
Available in RequestOptions to know when request has been sent.