copyWith method

Conversation copyWith({
  1. String? id,
  2. String? title,
  3. List<ChatMessage>? messages,
  4. DateTime? createdAt,
  5. DateTime? updatedAt,
})

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({
  final String? id,
  final String? title,
  final List<ChatMessage>? messages,
  final DateTime? createdAt,
  final DateTime? updatedAt,
}) => Conversation(
  id: id ?? this.id,
  title: title ?? this.title,
  messages: messages ?? this.messages,
  createdAt: createdAt ?? this.createdAt,
  updatedAt: updatedAt ?? this.updatedAt,
);