additionalProperties property
Object?
get
additionalProperties
Rules for additional properties that don't match the properties or patternProperties schemas.
Can be either a bool or a Schema, if it is a Schema then additional properties should match that Schema.
For example, to define a schema where any property not explicitly defined
in properties
should have an integer value:
final schema = ObjectSchema(
properties: {'name': Schema.string()},
additionalProperties: Schema.int(),
);
In this schema, an object like {'name': 'John', 'age': 30}
would be
valid, but {'name': 'John', 'age': 'thirty'}
would be invalid because
age
is not a defined property and its value is not an integer as
required by additionalProperties
.
Implementation
Object? get additionalProperties => _value['additionalProperties'];