isName method

bool isName(
  1. String name
)

Validates if the given name contains only alphabets and spaces.

Returns true if the name is valid, otherwise false.

Implementation

bool isName(String name) {
  bool nameValid = RegExp(r'^[a-zA-Z\s]+$').hasMatch(name);
  return nameValid;
}