uniqueItems property
bool?
get
uniqueItems
Whether or not all the items in this list must be unique.
For example, to define a schema for a list where all items must be unique:
final schema = ListSchema(
items: Schema.string(),
uniqueItems: true,
);
In this schema, a list like ['apple', 'banana', 'cherry']
would be
valid, but ['apple', 'banana', 'apple']
would be invalid because it
contains duplicate items. Note that the type of the items is also
defined using the items
property; uniqueItems
only enforces the
uniqueness of the items, not their type or value, which are handled by
the corresponding schema in the items
property.
Implementation
bool? get uniqueItems => _value['uniqueItems'] as bool?;