required static method
Returns a validator that checks whether a field is not empty.
Implementation
static String? Function(String?) required(
[String message = 'This field is required']) {
return (value) {
if (value == null || value.trim().isEmpty) return message;
return null;
};
}