validateEmptyText static method
Validates if the given text is empty.
fieldName
: The name of the field being validated.value
: The value entered in the field.
Returns a string error message if the field is empty, otherwise null.
Implementation
static String? validateEmptyText(String? fieldName, String? value) {
if (value == null || value.isEmpty) {
return '$fieldName is required.'; // Return error message if the field is empty.
}
return null; // Return null if the field is not empty.
}