value property
String?
get
value
CPF as a 11-digits value — non-numeric characters are stripped from it.
There are three scenarios for a CPF value:
- if the CPF is properly masked (###.###.###-##), it will be stripped of its two dots "." and hyphen "-"; therefore, if the input value is '133.497.166-07', the return value will be '13349716607'.
- if the CPF is composed entirely of 11 numbers, it will remain unchanged; thus, the return value will be the CPF as-is.
- if the CPF is malformed, then the return value will be null as an indication of a formatting error.
Implementation
String? get value => _isWellFormed ? _strip : null;