graphemes function
Splits string into user-perceived characters (grapheme clusters).
Follows the Unicode grapheme breaking rules, so an emoji family, a flag or a letter followed by combining accents each come back as one element. An empty string yields nothing.
Implementation
Iterable<String> graphemes(String string) sync* {
if (string.isEmpty) return;
final breaks = _Breaks(string);
var start = 0;
int brk;
while ((brk = breaks.nextBreak()) >= 0) {
yield string.substring(start, brk);
start = brk;
}
}