copyWith method
Creates a copy of this message with the given fields replaced with new values.
All fields are optional. If a field is not provided, the original value is kept.
Implementation
ChatMessage copyWith({
String? id,
String? chatId,
String? authorId,
String? authorDisplayName,
String? authorAvatarUrl,
String? text,
DateTime? createdAt,
DateTime? updatedAt,
bool? isSystem,
bool? isDeleted,
String? replyToMessageId,
ChatReplySnapshot? replyToSnapshot,
}) {
return ChatMessage(
id: id ?? this.id,
chatId: chatId ?? this.chatId,
authorId: authorId ?? this.authorId,
authorDisplayName: authorDisplayName ?? this.authorDisplayName,
authorAvatarUrl: authorAvatarUrl ?? this.authorAvatarUrl,
text: text ?? this.text,
createdAt: createdAt ?? this.createdAt,
updatedAt: updatedAt ?? this.updatedAt,
isSystem: isSystem ?? this.isSystem,
isDeleted: isDeleted ?? this.isDeleted,
replyToMessageId: replyToMessageId ?? this.replyToMessageId,
replyToSnapshot: replyToSnapshot ?? this.replyToSnapshot,
);
}