validateValue method

  1. @override
String? validateValue(
  1. T? valueCandidate
)
override

Validates the value. Returns null if the value is valid, otherwise an error message. Call validate() instead of this method when using the validator.

Implementation

@override
String? validateValue(T? valueCandidate) {
  final List<String> errors = <String>[];
  for (final FormFieldValidator<T?> validator in validators) {
    final String? error = validator(valueCandidate);
    if (error != null) {
      errors.add(error);
    }
  }
  return errors.isNotEmpty ? errors.join('\n') : null;
}