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