toJsonList static method

List<Map<String, dynamic>> toJsonList(
  1. List<ChatModel> list
)

Converts a list of ChatModel instances to a list of JSON objects.

The list parameter represents the list of ChatModel instances to convert.

Returns a list of maps representing the JSON objects.

Implementation

static List<Map<String, dynamic>> toJsonList(List<ChatModel> list) {
  List<Map<String, dynamic>> listJson = [];
  list.forEach((element) {
    listJson.add(element.toJson());
  });
  return listJson;
}