performValidation method
Validates a given value against the schema and configured validation rules.
path
a dot notation path to the value.value
a value to be validated.results
a list with validation results to add new results.
Implementation
void performValidation(
String? path, dynamic value, List<ValidationResult> results) {
var name = path ?? 'value';
if (value == null) {
if (isRequired()) {
results.add(ValidationResult(path, ValidationResultType.Error,
'VALUE_IS_NULL', name + ' must not be null', 'NOT NULL', null));
}
} else {
value = ObjectReader.getValue(value);
// Check validation rules
if (_rules != null) {
for (var i = 0; i < _rules!.length; i++) {
var rule = _rules![i];
rule.validate(path, this, value, results);
}
}
}
}