maxLength function
Creates a validator that fails when a string value exceeds n characters.
Returns message (or 'Must be at most $n characters.' by default) when invalid,
and null when valid.
final bioField = BloomFormField(
validators: [maxLength(280, 'Bio cannot exceed 280 characters.')],
);
Implementation
String? Function(String) maxLength(int n, [String? message]) =>
(v) => v.length > n ? (message ?? 'Must be at most $n characters.') : null;