validateName static method

String? validateName(
  1. String? value,
  2. int pos
)

Validator for the first name and last name form fields

Implementation

static String? validateName(String? value, int pos) {
  if (value == null || value.isEmpty) {
    return 'Please enter a valid ${pos == 1 ? 'first' : 'last'} name';
  }

  return null;
}