decryptIndex function

Map<String, List<int>>? decryptIndex(
  1. Uint8List bytes
)

Implementation

Map<String, List<int>>? decryptIndex(Uint8List bytes) {
  assert(_indexDecKey != null);
  if (_indexDecKey == null) return null;

  bytes = _decrypt(_indexDecKey!, bytes, mode: VBDL_INDEX_ENCMODE)!;
  if (bytes == null) return null;
  final data = zlib.decode(bytes);
  if (data == null) return null;

  final string = String.fromCharCodes(data);

  Map<String, dynamic> map = json.decode(string);
  Map<String, List<int>> indexMap = {};
  map.forEach((k, v) {
    List<dynamic> pp = v;
    List<int> vv = [];
    assert(pp.length == 3);
    for (var i in pp) {
      assert(i is int);
      vv.add(i);
    }
    indexMap[k] = vv;
  });
  return indexMap;
}