validateRequired method
Validates that a required field is not empty or null.
Returns an error message if the field is empty, otherwise null.
Implementation
///
/// Returns an error message if the field is empty, otherwise null.
String? validateRequired(String? input, String fieldName) {
if (input == null || input.trim().isEmpty) {
return '$fieldName is required.';
}
return null;
}