copyWith method

Message copyWith({
  1. String? id,
  2. String? serverId,
  3. String? conversationId,
  4. String? senderId,
  5. String? senderName,
  6. String? senderAvatar,
  7. String? anonymousName,
  8. String? anonymousAvatar,
  9. MessageContent? content,
  10. MessageType? type,
  11. MessageStatus? status,
  12. DateTime? clientTimestamp,
  13. DateTime? serverTimestamp,
  14. String? replyToId,
  15. Message? replyTo,
  16. List<FileAttachment>? attachments,
  17. List<Reaction>? reactions,
  18. List<String>? readBy,
  19. bool? isDeleted,
  20. bool? isEdited,
  21. bool? isStarred,
  22. bool? isPinned,
  23. DateTime? pinnedUntil,
  24. int? localSequence,
  25. Map<String, dynamic>? metadata,
})

Creates a copy with updated fields.

Implementation

Message copyWith({
  String? id,
  String? serverId,
  String? conversationId,
  String? senderId,
  String? senderName,
  String? senderAvatar,
  String? anonymousName,
  String? anonymousAvatar,
  MessageContent? content,
  MessageType? type,
  MessageStatus? status,
  DateTime? clientTimestamp,
  DateTime? serverTimestamp,
  String? replyToId,
  Message? replyTo,
  List<FileAttachment>? attachments,
  List<Reaction>? reactions,
  List<String>? readBy,
  bool? isDeleted,
  bool? isEdited,
  bool? isStarred,
  bool? isPinned,
  DateTime? pinnedUntil,
  int? localSequence,
  Map<String, dynamic>? metadata,
}) {
  return Message(
    id: id ?? this.id,
    serverId: serverId ?? this.serverId,
    conversationId: conversationId ?? this.conversationId,
    senderId: senderId ?? this.senderId,
    senderName: senderName ?? this.senderName,
    senderAvatar: senderAvatar ?? this.senderAvatar,
    anonymousName: anonymousName ?? this.anonymousName,
    anonymousAvatar: anonymousAvatar ?? this.anonymousAvatar,
    content: content ?? this.content,
    type: type ?? this.type,
    status: status ?? this.status,
    clientTimestamp: clientTimestamp ?? this.clientTimestamp,
    serverTimestamp: serverTimestamp ?? this.serverTimestamp,
    replyToId: replyToId ?? this.replyToId,
    replyTo: replyTo ?? this.replyTo,
    attachments: attachments ?? this.attachments,
    reactions: reactions ?? this.reactions,
    readBy: readBy ?? this.readBy,
    isDeleted: isDeleted ?? this.isDeleted,
    isEdited: isEdited ?? this.isEdited,
    isStarred: isStarred ?? this.isStarred,
    isPinned: isPinned ?? this.isPinned,
    pinnedUntil: pinnedUntil ?? this.pinnedUntil,
    localSequence: localSequence ?? this.localSequence,
    metadata: metadata ?? this.metadata,
  );
}