CardMessage constructor

CardMessage({
  1. required String text,
  2. String? imageUrl,
  3. required List<BaseInteractiveElement> cardActions,
  4. dynamic tags,
  5. int? id,
  6. String? muid,
  7. User? sender,
  8. AppEntity? receiver,
  9. required String receiverUid,
  10. String type = MessageTypeConstants.card,
  11. required String receiverType,
  12. String? category = MessageCategoryConstants.interactive,
  13. DateTime? sentAt,
  14. DateTime? deliveredAt,
  15. DateTime? readAt,
  16. Map<String, dynamic>? metadata,
  17. DateTime? readByMeAt,
  18. DateTime? deliveredToMeAt,
  19. DateTime? deletedAt,
  20. DateTime? editedAt,
  21. String? deletedBy,
  22. String? editedBy,
  23. DateTime? updatedAt,
  24. String? conversationId,
  25. int? parentMessageId,
  26. int? replyCount,
  27. InteractionGoal? interactionGoal,
  28. List<Interaction>? interactions,
  29. bool? allowSenderInteraction,
})

Creates a new CardMessage instance.

The text is the main text content of the card.

The cardActions is a list of interactive elements or actions available within the card.

The rest of the parameters are optional and are inherited from InteractiveMessage.

Implementation

CardMessage(
    {required this.text,
    this.imageUrl,
    required this.cardActions,
    tags,
    int? id,
    String? muid,
    super.sender,
    super.receiver,
    required super.receiverUid,
    super.type = MessageTypeConstants.card,
    required super.receiverType,
    String? category = MessageCategoryConstants.interactive,
    super.sentAt,
    super.deliveredAt,
    super.readAt,
    super.metadata,
    super.readByMeAt,
    super.deliveredToMeAt,
    super.deletedAt,
    super.editedAt,
    super.deletedBy,
    super.editedBy,
    super.updatedAt,
    super.conversationId,
    int? parentMessageId,
    int? replyCount,
    InteractionGoal? interactionGoal,
    super.interactions,
    bool? allowSenderInteraction})
    : super(
          id: id ?? 0,
          muid: muid ?? '',
          parentMessageId: parentMessageId ?? 0,
          replyCount: replyCount ?? 0,
          interactionGoal: interactionGoal ??
              InteractionGoal(
                  type: InteractionGoalTypeConstants.none, elementIds: []),
          allowSenderInteraction: allowSenderInteraction ?? false,
          interactiveData: {
            CardMessageKeys.cardActions:
                cardActions.map((e) => e.toMap()).toList(),
            CardMessageKeys.text: text,
            CardMessageKeys.imageUrl: imageUrl,
          });