isValid static method
bool
isValid(
- String cnpj, [
- dynamic stripBeforeValidation = true
])
Implementation
static bool isValid(String cnpj, [stripBeforeValidation = true]) {
if (stripBeforeValidation) cnpj = strip(cnpj);
if (cnpj.isEmpty) return false;
if (cnpj.length != 14) return false;
if (blackList.contains(cnpj)) return false;
String numbers = cnpj.substring(0, 12);
numbers += _verifierDigit(numbers).toString();
numbers += _verifierDigit(numbers).toString();
return numbers.substring(numbers.length - 2) ==
cnpj.substring(cnpj.length - 2);
}