Map<String, dynamic>
toJson()
Implementation
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = new Map<String, dynamic>();
data['from'] = this.from;
data['to'] = this.to;
data['body'] = this.body!.toJson();
data['attributes'] = this.attributes;
data['direction'] =
this.direction == EMMessageDirection.SEND ? 'send' : 'rec';
data['hasRead'] = this.hasRead;
data['hasReadAck'] = this.hasReadAck;
data['hasDeliverAck'] = this.hasDeliverAck;
data['msgId'] = this.msgId;
data['conversationId'] = this.conversationId ?? this.to;
data['chatType'] = chatTypeToInt(this.chatType);
data['localTime'] = this.localTime;
data['serverTime'] = this.serverTime;
data['status'] = _chatStatusToInt(this.status);
return data;
}