emojiFlag function
Returns the emoji flag for the given two-letter ISO 3166-1 countryCode.
Example: emojiFlag('US') β πΊπΈ
Implementation
String emojiFlag(String countryCode) {
assert(countryCode.length == 2);
final int firstLetter = countryCode.codeUnitAt(0) - 0x41 + 0x1F1E6;
final int secondLetter = countryCode.codeUnitAt(1) - 0x41 + 0x1F1E6;
return String.fromCharCode(firstLetter) + String.fromCharCode(secondLetter);
}