withRequiredProperty method
ObjectSchema
withRequiredProperty(])
inherited
Adds a validation schema for a required object property.
name
a property name.type
(optional) a property schema or type.rules
(optional) a list of property validation rules.
Implementation
ObjectSchema withRequiredProperty(String name,
[dynamic type, List<IValidationRule>? rules]) {
var schema = PropertySchema(name, type);
if (rules != null) {
schema.setRules(List.from(rules));
}
schema.makeRequired();
return withProperty(schema);
}