toUnicode function
Returns an Unicode representation of the character code.
Example: print(toUnicode(48)); => \u0030
Implementation
String toUnicode(int charCode) {
if (charCode < 0 || charCode > _UNICODE_END) {
throw RangeError.range(charCode, 0, _UNICODE_END, 'charCode');
}
var hex = charCode.toRadixString(16);
var length = hex.length;
if (length < 4) {
hex = hex.padLeft(4, '0');
}
return '\\u$hex';
}