headerValue property Null safety

String headerValue

Constructs a header value configured from this instance.

This value is used for the 'Cache-Control' header.

Implementation

String get headerValue {
  if (preventCaching) {
    return "no-cache, no-store";
  }

  final items = [];

  if (preventIntermediateProxyCaching) {
    items.add("private");
  } else {
    items.add("public");
  }

  if (expirationFromNow != null) {
    items.add("max-age=${expirationFromNow!.inSeconds}");
  }

  if (requireConditionalRequest) {
    items.add("no-cache");
  }

  return items.join(", ");
}