isTextOnly method

bool isTextOnly()

Checks if the entire string consists only of alphabet letters (a-z, A-Z).

@returns True if the string contains only letters and is not empty.

Example:

print('Flutter'.isTextOnly());    // true
print('Flutter Dev'.isTextOnly()); // false (contains space)
print('123'.isTextOnly());         // false

Implementation

bool isTextOnly() => RegExp(r'^[a-zA-Z]+$').hasMatch(this);