validator method Null safety
- String? value
Valida rut en base al cálculo de su dígito verificador y formato.
Implementation
String? validator(String? value) {
if (value == null) return null;
value = formatFromText(value);
try {
this.numbers = getRutNumbers(value);
this.dv = getRutDV(value);
} catch (e) {
// print('RUT Validation Error: $e');
return this.validationErrorText;
}
return (value.length <= 10 || this.numbers < 1000000 || !this.isValid)
? this.validationErrorText
: null;
}