pattern function
Creates a validator that fails when a string value does not match regular expression re.
Returns message (or 'Invalid format.' by default) when invalid, and null when valid.
final zipField = BloomFormField(
validators: [pattern(RegExp(r'^\d{5}$'), 'Zip code must be 5 digits.')],
);
Implementation
String? Function(String) pattern(RegExp re, [String? message]) =>
(v) => re.hasMatch(v) ? null : (message ?? 'Invalid format.');