toJson method
dynamic
toJson()
Implementation
toJson() {
var messageToSend;
if (type == MessageType.text.name ||
type == MessageType.button.name ||
type == MessageType.media.name ||
type == MessageType.location.name ||
type == MessageType.file.name) {
messageToSend = message!.data![0];
} else {
messageToSend = message!.toJson();
}
return {
'isUser': isUser,
'message': messageToSend,
'error': error,
'receptionDate': receptionDate,
'method': method,
'type': type
};
}