toJson method

Map<String, dynamic> toJson()

Implementation

Map<String, dynamic> toJson() => {
      "_id": id,
      "author": author!.toJson(),
      "status": status,
      "channelMessageId": channelMessageId,
      "message": message,
      "readBy":
          readBy == null ? [] : List<dynamic>.from(readBy!.map((x) => x)),
      "forwarded": forwarded,
      "isChild": isChild,
      "parentId": parentId,
      "isDeleted": isDeleted,
      "messageType": messageType,
      "direction": direction,
      "recipient": recipient,
      "channel": channel,
      "extension": extension,
      "createdAt": createdAt?.toIso8601String(),
      "interactionId": interactionId,
      "attachments": attachments.isEmpty
          ? []
          : List<dynamic>.from(attachments.map((x) => x!.toJson())),
      "updatedAt": updatedAt?.toIso8601String(),
      "__v": v,
      "uniqueId": uniqueId,
      "extraPayload": extraPayload!.toJson(),
      "isDelivered": isDelivered
    };