copyWith method

  1. @override
SenderMessage copyWith({
  1. bool? isLoading,
  2. List<MessageElement>? elements,
  3. bool? isFailed,
  4. String? timestamp,
  5. double? width,
})
override

Creates a copy of this message with updated properties.

This method supports the Immutable Object pattern by allowing state updates without modifying the original instance.

Implementation

@override
SenderMessage copyWith({
  bool? isLoading,
  List<MessageElement>? elements,
  bool? isFailed,
  String? timestamp,
  double? width,
}) {
  return SenderMessage(
    id: id,
    timestamp: timestamp ?? this.timestamp,
    elements: elements ?? this.elements,
    isLoading: isLoading ?? this.isLoading,
    isFailed: isFailed ?? this.isFailed,
    name: name,
    width: width ?? this.width,
  );
}