isValidFullName static method

String? isValidFullName(
  1. String? fullName
)

Implementation

static String? isValidFullName(String? fullName) {
  if (fullName == null || fullName.isEmpty) {
    return 'Please enter your full name.';
  }

  final fullNameRegExp = RegExp(r'^[a-zA-Z ]{3,}(?: [a-zA-Z ]{3,}){1,}$');
  if (!fullNameRegExp.hasMatch(fullName)) {
    return 'Please enter a valid full name.';
  }

  if (fullName.length > 85) {
    return 'Full name must not exceed 85 characters.';
  }

  return null;
}