alphabetic static method

String? alphabetic(
  1. String? value, {
  2. String? message,
})

Validates alphabetic characters only

Example:

Validators.alphabetic('abc');

Implementation

static String? alphabetic(String? value, {String? message}) {
  if (value == null || value.isEmpty) return null;
  final regex = RegExp(r'^[a-zA-Z]+$');
  if (!regex.hasMatch(value)) {
    return message ?? 'Only alphabetic characters are allowed';
  }
  return null;
}