CacheControlHeader constructor
CacheControlHeader({
- bool noCache = false,
- bool noStore = false,
- int? maxAge,
- int? staleWhileRevalidate,
- bool? publicCache,
- bool? privateCache,
- bool mustRevalidate = false,
- bool proxyRevalidate = false,
- int? sMaxAge,
- bool noTransform = false,
- bool onlyIfCached = false,
- int? staleIfError,
- int? maxStale,
- int? minFresh,
- bool immutable = false,
- bool mustUnderstand = false,
Constructs a CacheControlHeader instance with the specified directives.
Implementation
CacheControlHeader({
this.noCache = false,
this.noStore = false,
this.maxAge,
this.staleWhileRevalidate,
this.publicCache,
this.privateCache,
this.mustRevalidate = false,
this.proxyRevalidate = false,
this.sMaxAge,
this.noTransform = false,
this.onlyIfCached = false,
this.staleIfError,
this.maxStale,
this.minFresh,
this.immutable = false,
this.mustUnderstand = false,
}) {
if (publicCache == true && privateCache == true) {
throw const FormatException('Must be either public or private');
}
if (maxAge != null && staleWhileRevalidate != null) {
throw const FormatException(
'Cannot have both max-age and stale-while-revalidate directives',
);
}
}