compressToUTF16 static method

Future<String> compressToUTF16(
  1. String? input
)

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 Future<String> compressToUTF16(String? input) async {
  if (input == null) return "";
  return await _compress(input, 15, (a) => String.fromCharCode(a + 32)) + " ";
}