recentChatListToJson function
Converts a list of RecentChat objects into a JSON string.
This function takes a list of RecentChat objects, converts each object to a map using the toJson
method,
and then encodes the list of maps as a JSON string.
Parameters:
data
- A list of RecentChat objects.
Returns: A JSON string representing the list of recent chats.
Implementation
String recentChatListToJson(List<RecentChat> data) =>
json.encode(List<dynamic>.from(data.map((x) => x.toJson())));