encodeToNyaCodeSync method

String encodeToNyaCodeSync(
  1. String input
)

Implementation

String encodeToNyaCodeSync(String input) {
  String asciiInput = Uri.encodeComponent(input);
  String result = '';
  for (int i = 0; i < asciiInput.length; i++) {
    int x = asciiInput.codeUnitAt(i);
    String c1 = dict[(x & 192) >> 6]; // 192=0b11000000
    String c2 = dict[x & 63]; // 63=0b00111111
    result += c1 + c2;
  }
  return result;
}