LogRedactor class

Masks secrets before data is logged, shown in a debug tool or sent to a crash reporter.

Constructors

LogRedactor({List<String> sensitiveKeys = defaultSensitiveKeys, String mask = '***', bool maskPatterns = true})
const

Properties

hashCode → int
The hash code for this object.
no setterinherited
mask → String
final
maskPatterns → bool
Also masks JWTs, Bearer tokens and card numbers inside strings.
final
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited
sensitiveKeys → List<String>
final

Methods

isSensitiveKey(Object? key) → bool
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
redact(dynamic value) → dynamic
A deep copy of value with sensitive map entries masked. Strings are passed through redactText.
redactText(String text) → String
text with JWTs, bearer tokens and card numbers masked.
toString() → String
A string representation of this object.
inherited

Operators

operator ==(Object other) → bool
The equality operator.
inherited

Constants

defaultSensitiveKeys → const List<String>
Map keys are masked when they contain one of these (case-insensitive). Words of 4 letters or fewer must be a whole word of the key, so pin masks pin and userPin but not shipping.