This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| public class CountryFlags { | |
| private static String A = getEmojiByUnicode(0x1F1E6); | |
| private static String B = getEmojiByUnicode(0x1F1E7); | |
| private static String C = getEmojiByUnicode(0x1F1E8); | |
| private static String D = getEmojiByUnicode(0x1F1E9); | |
| private static String E = getEmojiByUnicode(0x1F1EA); | |
| private static String F = getEmojiByUnicode(0x1F1EB); | |
| private static String G = getEmojiByUnicode(0x1F1EC); | |
| private static String H = getEmojiByUnicode(0x1F1ED); | |
| private static String I = getEmojiByUnicode(0x1F1EE); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| void main() { | |
| const int flagOffset = 0x1F1E6; | |
| const int asciiOffset = 0x41; | |
| final codeToCountryEmoji = (code) { | |
| final char1 = code.codeUnitAt(0) - asciiOffset + flagOffset; | |
| final char2 = code.codeUnitAt(1) - asciiOffset + flagOffset; | |
| return String.fromCharCode(char1) + String.fromCharCode(char2); | |
| }; |