SyncUpdate.fromJson constructor
Implementation
SyncUpdate.fromJson(Map<String, Object?> json)
: nextBatch = json.tryGet<String>('next_batch') ?? '',
rooms = (() {
final temp = json.tryGetMap<String, Object?>('rooms');
return temp != null ? RoomsUpdate.fromJson(temp) : null;
}()),
presence = json
.tryGetMap<String, List<Object?>>('presence')?['events']
?.map((i) => Presence.fromJson(i as Map<String, Object?>))
.toList(),
accountData = json
.tryGetMap<String, List<Object?>>('account_data')?['events']
?.map((i) => BasicEvent.fromJson(i as Map<String, Object?>))
.toList(),
toDevice = json
.tryGetMap<String, List<Object?>>('to_device')?['events']
?.map(
(i) => BasicEventWithSender.fromJson(i as Map<String, Object?>),
)
.toList(),
deviceLists = (() {
final temp = json.tryGetMap<String, Object?>('device_lists');
return temp != null ? DeviceListsUpdate.fromJson(temp) : null;
}()),
deviceOneTimeKeysCount =
json.tryGetMap<String, int>('device_one_time_keys_count'),
deviceUnusedFallbackKeyTypes =
json.tryGetList<String>('device_unused_fallback_key_types') ??
json.tryGetList<String>(
'org.matrix.msc2732.device_unused_fallback_key_types',
);