toJson method

  1. @override
Map<String, dynamic> toJson()
override

Implementation

@override
Map<String, dynamic> toJson() {
  final data = <String, dynamic>{};
  if (stateKey != null) data['state_key'] = stateKey;
  if (prevContent?.isNotEmpty == true) {
    data['prev_content'] = prevContent;
  }
  data['content'] = content;
  data['type'] = type;
  data['event_id'] = eventId;
  data['room_id'] = roomId;
  data['sender'] = senderId;
  data['origin_server_ts'] = originServerTs.millisecondsSinceEpoch;
  if (unsigned?.isNotEmpty == true) {
    data['unsigned'] = unsigned;
  }
  if (originalSource != null) {
    data['original_source'] = originalSource?.toJson();
  }
  return data;
}