validator method

String? validator([
  1. Object? object
])

This method returns null if the field is valid. Otherwise it will return the error's string specified in the validator (see Validator).

Implementation

String? validator([Object? object]) {
  for (final Validator validator in validators) {
    final String? error = validator.validate(value);

    if (error != null) return error;
  }

  return null;
}