CardMessage constructor
CardMessage({
- required String text,
- String? imageUrl,
- required List<
BaseInteractiveElement> cardActions, - dynamic tags,
- int? id,
- String? muid,
- User? sender,
- AppEntity? receiver,
- required String receiverUid,
- String type = MessageTypeConstants.card,
- required String receiverType,
- String? category = MessageCategoryConstants.interactive,
- DateTime? sentAt,
- DateTime? deliveredAt,
- DateTime? readAt,
- Map<
String, dynamic> ? metadata, - DateTime? readByMeAt,
- DateTime? deliveredToMeAt,
- DateTime? deletedAt,
- DateTime? editedAt,
- String? deletedBy,
- String? editedBy,
- DateTime? updatedAt,
- String? conversationId,
- int? parentMessageId,
- int? replyCount,
- InteractionGoal? interactionGoal,
- List<
Interaction> ? interactions, - 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,
});