isLatin property

bool isLatin

Checks if the String has only Latin characters.

Example

String foo = 'this is a τεστ';
bool isLatin = foo.isLatin; // returns false
String foo2 = 'this is hello world';
bool isLatin2 = foo2.isLatin; // returns true

Implementation

bool get isLatin {
  if (this.isBlank) {
    return false;
  }
  return RegExp(r'^[a-zA-Z\s]+$').hasMatch(this!);
}