copyWith method

ChatMessage copyWith({
  1. String? id,
  2. String? content,
  3. String? role,
  4. DateTime? timestamp,
  5. bool? isLoading,
  6. String? imageUrl,
  7. Uint8List? imageBytes,
  8. String? fileName,
  9. MessageType? type,
  10. bool? isThinking,
  11. String? thinkingStatus,
  12. bool? isStreaming,
  13. List<QuickReplyButton>? quickReplies,
  14. Map<String, dynamic>? uiComponentData,
  15. String? audioPath,
  16. int? audioDuration,
})

Implementation

ChatMessage copyWith({
  String? id,
  String? content,
  String? role,
  DateTime? timestamp,
  bool? isLoading,
  String? imageUrl,
  Uint8List? imageBytes,
  String? fileName,
  MessageType? type,
  bool? isThinking,
  String? thinkingStatus,
  bool? isStreaming,
  List<QuickReplyButton>? quickReplies,
  Map<String, dynamic>? uiComponentData,
  String? audioPath,
  int? audioDuration,
}) {
  return ChatMessage(
    id: id ?? this.id,
    content: content ?? this.content,
    role: role ?? this.role,
    timestamp: timestamp ?? this.timestamp,
    isLoading: isLoading ?? this.isLoading,
    imageUrl: imageUrl ?? this.imageUrl,
    imageBytes: imageBytes ?? this.imageBytes,
    fileName: fileName ?? this.fileName,
    type: type ?? this.type,
    isThinking: isThinking ?? this.isThinking,
    thinkingStatus: thinkingStatus ?? this.thinkingStatus,
    isStreaming: isStreaming ?? this.isStreaming,
    quickReplies: quickReplies ?? this.quickReplies,
    uiComponentData: uiComponentData ?? this.uiComponentData,
    audioPath: audioPath ?? this.audioPath,
    audioDuration: audioDuration ?? this.audioDuration,
  );
}