toJson method
Implementation
Map<String, Object?> toJson() {
final data = <String, Object?>{};
data['next_batch'] = nextBatch;
if (rooms != null) {
data['rooms'] = rooms!.toJson();
}
if (presence != null) {
data['presence'] = {
'events': presence!.map((i) => i.toJson()).toList(),
};
}
if (accountData != null) {
data['account_data'] = {
'events': accountData!.map((i) => i.toJson()).toList(),
};
}
if (toDevice != null) {
data['to_device'] = {
'events': toDevice!.map((i) => i.toJson()).toList(),
};
}
if (deviceLists != null) {
data['device_lists'] = deviceLists!.toJson();
}
if (deviceOneTimeKeysCount != null) {
data['device_one_time_keys_count'] = deviceOneTimeKeysCount;
}
if (deviceUnusedFallbackKeyTypes != null) {
data['device_unused_fallback_key_types'] = deviceUnusedFallbackKeyTypes;
data['org.matrix.msc2732.device_unused_fallback_key_types'] =
deviceUnusedFallbackKeyTypes;
}
return data;
}