OutboundGroupSession.fromJson constructor

OutboundGroupSession.fromJson(
  1. Map<String, dynamic> dbEntry,
  2. String key
)

Implementation

OutboundGroupSession.fromJson(Map<String, dynamic> dbEntry, this.key) {
  try {
    for (final entry in json.decode(dbEntry['device_ids']).entries) {
      devices[entry.key] = Map<String, bool>.from(entry.value);
    }
  } catch (e) {
    // devices is bad (old data), so just not use this session
    Logs().i(
      '[OutboundGroupSession] Session in database is old, not using it. $e',
    );
    return;
  }
  outboundGroupSession = olm.OutboundGroupSession();
  try {
    outboundGroupSession!.unpickle(key, dbEntry['pickle']);
    creationTime =
        DateTime.fromMillisecondsSinceEpoch(dbEntry['creation_time']);
  } catch (e, s) {
    dispose();
    Logs().e('[LibOlm] Unable to unpickle outboundGroupSession', e, s);
  }
}