toJson method
Implementation
Map<String, dynamic> toJson() {
var statusList = [];
if (statuses != null) {
statuses!.forEach((val) {
statusList.add(val.toString().split('.').last);
});
}
final ret = <String, dynamic>{
'channel_url': channelUrl,
'channel_type': channelType.toString().split('.').last,
'senderId': senderId,
'status': statusList.isEmpty ? null : statusList,
'message_type':
messageType == null ? null : messageType.toString().split('.').last,
};
ret.removeWhere((key, value) => value == null);
return ret;
}