toJson method
Implementation
Map<String, dynamic> toJson() {
if (this is RequestChatEvent) {
return {
'type': 'request',
'message': (this as RequestChatEvent).message.toJson(),
};
} else if (this is ResponseChatEvent) {
final res = this as ResponseChatEvent;
return {
'type': 'response',
'message': res.response.toJson(),
'usage': res.usage.toJson(),
};
}
return {
'type': 'undefined',
};
}