$errors property

List<ValidationError> $errors
override

Implementation

List<ValidationError> get $errors {
  if (_isValid) {
    return const [];
  }
  var errorElements = List<ResultObject>.from(_elements);
  errorElements.retainWhere((e) => e.$isNotValid);
  final errorCount = errorElements.length;
  if (errorCount > 0) {
    final elementError = ValidationError(
        'ElementErrors',
        'Validation failed for ${errorCount} element(s).',
        '0 errors.',
        '${errorCount} errors.');
    final errors = _value.$errors;
    errors.add(elementError);
    return errors;
  } else {
    return _value.$errors;
  }
}