unevaluatedItems property
bool?
get
unevaluatedItems
Whether or not additional items in the list are allowed that don't match the items or prefixItems schemas.
For example, to define a schema for a list where only items matching
prefixItems
or items
are allowed:
final schema = ListSchema(
prefixItems: [Schema.string(), Schema.int()],
items: Schema.bool(),
unevaluatedItems: false,
);
In this schema, a list like ['hello', 42, true]
would be valid, but
['hello', 42, true, 123]
would be invalid because the last item does
not match the schema defined by items
(which applies to items
beyond those covered by prefixItems
), and unevaluatedItems
is set
to false
, disallowing any items not explicitly matched by the
schema.
Implementation
bool? get unevaluatedItems => _value['unevaluatedItems'] as bool?;