CacheControlHeader constructor

CacheControlHeader({
  1. bool noCache = false,
  2. bool noStore = false,
  3. int? maxAge,
  4. int? staleWhileRevalidate,
  5. bool? publicCache,
  6. bool? privateCache,
  7. bool mustRevalidate = false,
  8. bool proxyRevalidate = false,
  9. int? sMaxAge,
  10. bool noTransform = false,
  11. bool onlyIfCached = false,
  12. int? staleIfError,
  13. int? maxStale,
  14. int? minFresh,
  15. bool immutable = false,
  16. 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',
    );
  }
}