Take for example the codes for these emoticons
For two-byte codes like Dingbats (2702 - 27B0)
'abcd\u2702efg'
works fine but for longer codes like \u1F601
this doesn't work.
String.fromCharCode(0x1f601)
works though.
main() {
print('abcd\u2702efg');
print('abcd\u1F601efg');
print(new String.fromCharCode(0x1f601));
}
Try at DartPad
Is there a way to write U+1F601
as a string literal in Dart?
Enclose the character code in curly braces:
From §16.5, "Strings", of the Dart Programming Language Specification, Second Edition: