sendMessageModelToJson function
Converts a single ChatMessage object into a JSON string.
This function takes the provided ChatMessage object,
converts it to a JSON map using the toJson
method, and then encodes the map as a JSON string.
data
: The ChatMessage object to be converted.
Returns a JSON string representation of the chat message.
Implementation
String sendMessageModelToJson(ChatMessage data) => json.encode(data.toJson());