maxItems<T extends Iterable<Object?> > function
Creates a validator that fails when an Iterable collection has more than n items.
Returns message (or 'Must have at most $n items.' by default).
final tagsField = BloomTypedFormField<List<String>>(
initialValue: [],
validators: [maxItems(5, 'Cannot select more than 5 tags.')],
);
Implementation
String? Function(T) maxItems<T extends Iterable<Object?>>(int n,
[String? message]) =>
(v) => v.length > n ? (message ?? 'Must have at most $n items.') : null;