chatMessageModelFromJson function

List<ChatMessageModel> chatMessageModelFromJson(
  1. String str
)

Converts a JSON string into a list of ChatMessageModel objects.

This function decodes the given JSON string and uses the fromJson constructor of the ChatMessageModel class to create a list of instances.

Parameters: str - A JSON string representation of a list of ChatMessageModel objects.

Returns: A list of ChatMessageModel instances populated with data from the given JSON string.

Implementation

List<ChatMessageModel> chatMessageModelFromJson(String str) =>
    List<ChatMessageModel>.from(
        json.decode(str).map((x) => ChatMessageModel.fromJson(x)));