isGreek method Null safety

bool? isGreek()

Checks if the String has only Greek characters.

Example

String foo = 'this is a τεστ';
bool isLatin = foo.isLatin(); // returns false
String foo2 = 'Τα αγαθά κόποις κτώνται';
bool isLatin2 = foo2.isLatin(); // returns true

Implementation

bool? isGreek() {
  if (this == null) {
    return null;
  }
  if (this!.isEmpty) {
    return null;
  }
  return RegExp(r'^[α-ωΑ-ΩίϊΐόάέύϋΰήώΊΪΌΆΈΎΫΉΏ\s]+$').hasMatch(this!);
}