isValid static method
bool
isValid(
- String cpf, [
- dynamic stripBeforeValidation = true
])
Implementation
static bool isValid(String cpf, [stripBeforeValidation = true]) {
if (stripBeforeValidation) {
cpf = strip(cpf);
}
if (cpf.isEmpty) {
return false;
}
if (cpf.length != 11) {
return false;
}
if (BLACKLIST.indexOf(cpf) != -1) {
return false;
}
String numbers = cpf.substring(0, 9);
numbers += _verifierDigit(numbers).toString();
numbers += _verifierDigit(numbers).toString();
return numbers.substring(numbers.length - 2) ==
cpf.substring(cpf.length - 2);
}