copyWith method

ChatMessage copyWith({
  1. String? text,
  2. ChatUser? user,
  3. DateTime? createdAt,
  4. bool? isMarkdown,
  5. List<ChatMedia>? media,
  6. List<ChatRecipe>? recipes,
  7. List<ChatDocument>? documents,
  8. List<QuickReply>? quickReplies,
  9. List<MessageReaction>? reactions,
  10. Map<String, dynamic>? customProperties,
  11. Widget customBuilder(
    1. BuildContext,
    2. ChatMessage
    )?,
  12. bool? isSending,
  13. bool? hasError,
  14. String? errorMessage,
  15. bool? isWelcome,
  16. bool? loadingRecipe,
})

Creates a copy of this message with the given fields replaced with new values

Implementation

ChatMessage copyWith({String? text,
  ChatUser? user,
  DateTime? createdAt,
  bool? isMarkdown,
  List<ChatMedia>? media,
  List<ChatRecipe>? recipes,
  List<ChatDocument>? documents,
  List<QuickReply>? quickReplies,
  List<MessageReaction>? reactions,
  Map<String, dynamic>? customProperties,
  Widget Function(BuildContext, ChatMessage)? customBuilder,
  bool? isSending,
  bool? hasError,
  String? errorMessage,
  bool? isWelcome,
  bool? loadingRecipe}) =>
    ChatMessage(
        text: text ?? this.text,
        user: user ?? this.user,
        createdAt: createdAt ?? this.createdAt,
        isMarkdown: isMarkdown ?? this.isMarkdown,
        media: media ?? this.media,
        recipes: recipes ?? this.recipes,
        documents: documents ?? this.documents,
        quickReplies: quickReplies ?? this.quickReplies,
        reactions: reactions ?? this.reactions,
        customProperties: customProperties ?? this.customProperties,
        customBuilder: customBuilder ?? this.customBuilder,
        isSending: isSending ?? this.isSending,
        hasError: hasError ?? this.hasError,
        errorMessage: errorMessage ?? this.errorMessage,
        isWelcome: isWelcome ?? this.isWelcome,
        loadingRecipe: loadingRecipe ?? this.loadingRecipe);