Skip to content

Instantly share code, notes, and snippets.

@iampawan
Created April 16, 2020 10:36
Show Gist options
  • Save iampawan/7f45433550bca10f4e1e05178e8f3d34 to your computer and use it in GitHub Desktop.
Save iampawan/7f45433550bca10f4e1e05178e8f3d34 to your computer and use it in GitHub Desktop.
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);
};
print(codeToCountryEmoji("IN"));
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment