Validates the current text and returns an error message if invalid, or null if valid.
String? validate() => validator?.call(_text);