isNameValid method

bool isNameValid(
  1. String data
)

Checks if the provided data contains any special characters or digits.

Returns true if data contains any special characters or digits, otherwise returns false.

Example:

bool isValid = isNameValid('JohnDoe'); // Returns false
bool notValid = isNameValid('JohnDoe123'); // Returns true

Note: This function checks if data contains any characters other than letters and spaces.

Example:

bool isValid = isNameValid('John Doe'); // Returns true

Implementation

bool isNameValid(String data) {
  var expCheck = RegExp(r'[!@#<>?":_`~;[\]\\|=+)(*&^%0-9-]');
  if (expCheck.hasMatch(data)) {
    return true;
  }
  return false;
}