isValid method
Implementation
@override
bool isValid(String value) {
String v = strip(value);
/// phone must have 10 or 11 chars
if (v.length < 10 || v.length > 11) {
return false;
}
/// Não existe DDD com zero.
if (v[0] == '0' || v[1] == '0') {
return false;
}
/// Telefones celulares sempre iniciam com 9.
return !(v.length == 11 && v[2] != '9');
}