copyWith method

ChatMessage copyWith({
  1. String? id,
  2. String? chatId,
  3. String? authorId,
  4. String? authorDisplayName,
  5. String? authorAvatarUrl,
  6. String? text,
  7. DateTime? createdAt,
  8. DateTime? updatedAt,
  9. bool? isSystem,
  10. bool? isDeleted,
  11. String? replyToMessageId,
  12. ChatReplySnapshot? replyToSnapshot,
})

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,
  );
}