toJson static method

String toJson(
  1. String text
)

Implementation

static String toJson(String text) {
  final String trimmed = text.trim();
  if (trimmed.startsWith("{")) return trimmed;
  final Uint8List bytes = base64Decode(trimmed);
  for (int i = 0; i < bytes.length; i++) {
    bytes[i] = bytes[i] ^ (i % 253 + 4) & 0xFF;
  }
  return utf8.decode(bytes, allowMalformed: true);
}