UsSsnPattern class
Matches US Social Security Numbers (123-45-6789 or 123456789).
Format-only check — does not verify that the number has been issued. The mode field controls which input shape is accepted: ValidationMode.any (default) accepts either the fully-formatted or fully-unformatted shape, ValidationMode.formatted requires the dashes, and ValidationMode.unformatted rejects them.
V.string().taxId(
patterns: [const UsSsnPattern(mode: ValidationMode.formatted)],
);
- Inheritance
-
- Object
- TaxIdPattern
- UsSsnPattern
Constructors
- UsSsnPattern({ValidationMode mode = ValidationMode.any})
-
Creates a UsSsnPattern.
const
Properties
- hashCode → int
-
The hash code for this object.
no setterinherited
- mode → ValidationMode
-
Controls whether separators (dashes) are required, forbidden, or
optional. Defaults to ValidationMode.any.
final
- name → String
-
Human-readable name used in error messages and debugging.
no setteroverride
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
matches(
String value) → bool -
Returns
trueifvalueis a valid tax ID for this pattern.override -
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited