byteToVariationSelector function
Converts a byte value (0-255) to its corresponding variation selector character.
Bytes 0-15 map to VS1-VS16 (U+FE00 to U+FE0F). Bytes 16-255 map to VS17-VS256 (U+E0100 to U+E01EF).
Throws InvalidByteException if byte is outside the valid range.
Implementation
String byteToVariationSelector(int byte) {
if (byte < 0 || byte > 255) {
throw InvalidByteException(byte);
}
if (byte < 16) {
return String.fromCharCode(_variationSelectorStart + byte);
} else {
return String.fromCharCode(_variationSelectorSupplementStart + byte - 16);
}
}