isUnique method
Checks whether the String
is consisted of only unique characters.
Returns true String
if the String
is empty.
Example
String foo = 'Hello World';
bool isUnique = foo.isUnique; // returns false;
String foo = 'hello world';
bool isUnique = foo.isUnique; // returns true;
Implementation
bool isUnique() {
if (this.isBlank) {
return true;
}
final word = this;
final wordSplit = word.toGreekUpperCase()!.split('').toSet();
return word!.length == wordSplit.length;
}