validName static method

String? validName({
  1. String? value,
})

Implementation

static String? validName({String? value}) {
  if (value!.isEmpty) {
    return 'Please enter your name';
  } else if (value.trim().length < 3) {
    return 'Please enter your full name';
  } else if (!alphanumericRegex.hasMatch(value)) {
    return 'Please enter valid name';
  } else if (value.contains(RegExp(r'[0-9]'))) {
    return 'Please enter valid name';
  }
  return null;
}