patternRange property
patternRange
Specifies a value that each occurrence of the element in
the instance SHALL follow - that is, any value in the pattern must be
found in the instance, if the element has a value. Other additional
values may be found too. This is effectively constraint by example.
When patternx
is used to constrain a primitive, it means that the
value provided in the patternx
must match the instance value exactly.
When an element within a patternx
is used to constrain an array, it
means that each element provided in the patternx
must (recursively)
match at least one element from the instance array.
When patternx
is used to constrain a complex object, it means that
each property in the pattern must be present in the complex object,
and its value must recursively match -- i.e.,
- If primitive: it must match exactly the pattern value
- If a complex object: it must match (recursively) the pattern value
- If an array: it must match (recursively) the pattern value
If a patternx
is declared on a repeating element, the pattern applies
to all repetitions. If the desire is for a pattern to apply to only
one element or a subset of elements, slicing must be used. See
Examples of
Patterns for
examples of pattern usage and the effect it will have.
Implementation
Range? get patternRange => throw _privateConstructorUsedError;