copyWith method

ChatMessage copyWith({
  1. String? text,
  2. ChatUser? user,
  3. DateTime? createdAt,
  4. bool? isMarkdown,
  5. Map<String, dynamic>? customProperties,
})

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,
  Map<String, dynamic>? customProperties,
}) =>
    ChatMessage(
      text: text ?? this.text,
      user: user ?? this.user,
      createdAt: createdAt ?? this.createdAt,
      isMarkdown: isMarkdown ?? this.isMarkdown,
      customProperties: customProperties != null
          ? Map<String, dynamic>.from(customProperties)
          : this.customProperties != null
              ? Map<String, dynamic>.from(this.customProperties!)
              : null,
    );