normalizePolicy static method

String normalizePolicy(
  1. Object? value,
  2. String def
)

Normalizes a policy value: null resolves to def, while an empty value or the none sentinel resolves to '', omitting the header.

Implementation

static String normalizePolicy(Object? value, String def) {
  if (value == null) return def;

  var s = value.toString().trim();
  if (s.isEmpty || equalsIgnoreAsciiCase(s, 'none')) return '';

  return s;
}