copyWith method
Creates a copy of this conversation with some fields replaced.
Only the specified fields will be changed; all others remain the same.
Example:
final updatedConversation = conversation.copyWith(title: 'New Title');
Implementation
Conversation copyWith({
String? id,
String? title,
List<ChatMessage>? messages,
DateTime? createdAt,
DateTime? updatedAt,
}) =>
Conversation(
id: id ?? this.id,
title: title ?? this.title,
messages: messages ?? this.messages,
createdAt: createdAt ?? this.createdAt,
updatedAt: updatedAt ?? this.updatedAt,
);