DataMasker class
Main class for masking sensitive data.
Provides built-in maskers for common data types and supports custom masking rules.
Constructors
-
DataMasker({Map<
String, MaskingRule> ? customRules}) - Creates a DataMasker with optional custom rules.
Properties
Methods
-
applyRule(
String name, String input) → String -
Applies a named masking rule to
input. -
creditCard(
String number) → String - Masks a credit card number, showing only the last 4 digits.
-
email(
String email) → String - Masks an email address, showing first character and domain.
-
hasRule(
String name) → bool - Checks if a named rule exists.
-
maskMap(
Map< String, dynamic> data) → Map<String, dynamic> - Masks all sensitive fields in a map using field name heuristics.
-
name(
String fullName) → String - Masks a personal name, showing only the first letter.
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
phone(
String phoneNumber) → String - Masks a phone number, showing area code and last 4 digits.
-
registerCustomMasker(
String name, CustomMaskingFunction masker) → void -
Registers a custom masking function by
name. -
registerRule(
String name, MaskingRule rule) → void -
Registers a custom masking rule by
name. -
removeRule(
String name) → void - Removes a named rule.
-
ssn(
String ssn) → String - Masks a Social Security Number, showing only the last 4 digits.
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited