required static method
Ensures the field is not null or empty.
Implementation
static String? Function(String?) required({
String errorMessage = 'This field is required',
}) {
return (String? value) =>
value == null || value.trim().isEmpty ? errorMessage : null;
}