CnhPattern class Patterns

Valida CNHs brasileiras (Carteira Nacional de Habilitação — 11 dígitos).

Implementa o algoritmo oficial dos dois dígitos verificadores, incluindo a regra de decremento (dsc = 2) quando o DV1 ultrapassa 9.

V.string().taxId(patterns: [const CnhPattern()]);
V.string().cnh(); // atalho

See also:

Constructors

CnhPattern()
Cria um CnhPattern.
const

Properties

hashCode int
The hash code for this object.
no setterinherited
name String
Human-readable name used in error messages and debugging.
no setter
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

matches(String value) bool
Returns true if value is a valid tax ID for this pattern.
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