validate method
- dynamic value,
- String path
override
Validates value at path and returns every violation found.
path is a dot-notation string identifying the location of value
within the document (e.g. 'address.city', '' for the root). Violations
use path as their SchemaViolation.path.
Implementation
@override
List<SchemaViolation> validate(dynamic value, String path) {
if (value is! String || _fn == null) return [];
if (!_fn(value)) {
return [SchemaViolation(path: path, message: 'must be a valid $format')];
}
return [];
}