copyWith method
Creates a copy of this message with some fields replaced.
Only the specified fields will be changed; all others remain the same.
Example:
final updatedMessage = message.copyWith(content: 'Updated content');
Implementation
ChatMessage copyWith({
String? id,
String? content,
bool? isUser,
DateTime? timestamp,
}) =>
ChatMessage(
id: id ?? this.id,
content: content ?? this.content,
isUser: isUser ?? this.isUser,
timestamp: timestamp ?? this.timestamp,
);