registerSecret static method

void registerSecret(
  1. String? value
)

Registers a value that must be masked in every future log line.

Short values (fewer than 6 characters) and unresolved placeholders such as ${{TOKEN}} are ignored: masking them would either redact harmless text or hide the very placeholder the user needs to see while debugging.

Implementation

static void registerSecret(String? value) {
  if (value == null) return;
  final trimmed = value.trim();
  if (trimmed.length < 6) return;
  if (trimmed.contains(r'${') || trimmed.contains('%{')) return;
  _secrets.add(trimmed);
}