toHeader method

String toHeader()

Serialize cache-control values

Implementation

String toHeader() {
  final header = <String>[];

  if (maxAge != -1) header.add('$_maxAgeHeader=$maxAge');
  if (maxStale != -1) header.add('$_maxStaleHeader=$maxStale');
  if (minFresh != -1) header.add('$_minFreshHeader=$minFresh');
  if (mustRevalidate) header.add(_mustRevalidateHeader);
  if (privacy != null) header.add(privacy!);
  if (noCache) header.add(_noCacheHeader);
  if (noStore) header.add(_noStoreHeader);
  if (other.isNotEmpty) header.addAll(other);

  return header.join(', ');
}