toJson method
Implementation
Map<String, dynamic> toJson() {
final _data = <String, dynamic>{
'id': id,
'chat_id': chatId,
'text': text,
'files': files.map((e) => e.toJson()).toList(),
'sender_id': senderId,
'type': type.index,
'receiver_ids': receiverIds,
'extra_id': extraId,
'created_at': createdAt,
'updated_at': updatedAt,
'visibility': visibility,
...extraData,
};
return _data..removeWhere((key, value) => value == null);
}