compressToUTF16Sync static method
Synchronously produces "valid" UTF-16 strings from input
.
Can be decompressed with decompressFromUTF16.
This works by using only 15 bits of storage per character. The strings / produced are therefore 6.66% bigger than those produced by compress.
Implementation
static String? compressToUTF16Sync(String? input) {
final compressed = _compress(input, 15, (a) => String.fromCharCode(a + 32));
if (compressed == null) return null;
return compressed + " ";
}