alphabeticValidator function

String? alphabeticValidator(
  1. String value
)

Validates whether the input value contains only alphabetic characters.

Implementation

String? alphabeticValidator(String value) =>
    !RegExp(r'^[a-zA-Z]+$').hasMatch(value.trim())
        ? 'Please enter only letters.'
        : null;