decompressAndDecrypt function

Map<String, dynamic> decompressAndDecrypt(
  1. String anonKey,
  2. String content
)

Implementation

Map<String, dynamic> decompressAndDecrypt(String anonKey, String content) {
  try {
    final gzip = GZipDecoder();
    final compressedJson = base64.decode(content);
    final json = utf8.decode(gzip.decodeBytes(compressedJson));

    return jsonDecode(json);
  } catch (e) {
    throw Exception(
        'Error decompressing and decrypting, message: ${e.toString()}');
  }
}