Skip to content

Instantly share code, notes, and snippets.

@horgag
Created April 18, 2020 08:32
Show Gist options
  • Select an option

  • Save horgag/013f3c92ed2b8c9b1e3992bd740deb8d to your computer and use it in GitHub Desktop.

Select an option

Save horgag/013f3c92ed2b8c9b1e3992bd740deb8d to your computer and use it in GitHub Desktop.
method for country flags
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("IE"));
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment