Message.fromJson constructor

Message.fromJson(
  1. Map<String, dynamic> json
)

Implementation

factory Message.fromJson(Map<String, dynamic> json) => Message(
    id: json["_id"],
    author: Author.fromJson(json["author"]),
    status: json["status"],
    channelMessageId: json["channelMessageId"],
    message: json["message"],
    readBy: json["readBy"] == null
        ? []
        : List<dynamic>.from(json["readBy"]!.map((x) => x)),
    forwarded: json["forwarded"],
    isChild: json["isChild"],
    parentId: json["parentId"],
    isDeleted: json["isDeleted"],
    messageType: json["messageType"],
    direction: json["direction"],
    recipient: json["recipient"],
    channel: json["channel"],
    extension: json["extension"],
    createdAt: json["createdAt"] != null
        ? DateTime.parse(json["createdAt"]).toLocal()
        : DateTime.now(),
    interactionId: json["interactionId"],
    attachments: json["attachments"] == null
        ? []
        : List<Attachment?>.from(
            json["attachments"]!.map((x) => Attachment.fromJson(x))),
    updatedAt: DateTime.parse(json["updatedAt"] ?? DateTime.now().toString()),
    v: json["__v"],
    uniqueId: json["uniqueId"],
    extraPayload: ExtraPayload.fromJson(json["extraPayload"] ?? {}),
    isDelivered: json["isDelivered"] ?? false);