copyWith method

  1. @override
Message copyWith({
  1. Map<String, dynamic>? metadata,
  2. PreviewData? previewData,
  3. Status? status,
  4. String? text,
  5. int? updatedAt,
})
override

Creates a copy of the file message with an updated data. metadata with null value will nullify existing metadata, otherwise both metadatas will be merged into one Map, where keys from a passed metadata will overwite keys from the previous one. previewData is ignored for this message type. status with null value will be overwritten by the previous status. text is ignored for this message type. updatedAt with null value will nullify existing value.

Implementation

@override
Message copyWith({
  Map<String, dynamic>? metadata,
  PreviewData? previewData,
  Status? status,
  String? text,
  int? updatedAt,
}) {
  return FileMessage(
    author: author,
    createdAt: createdAt,
    id: id,
    metadata: metadata == null
        ? null
        : {
            ...this.metadata ?? {},
            ...metadata,
          },
    mimeType: mimeType,
    name: name,
    roomId: roomId,
    size: size,
    status: status ?? this.status,
    updatedAt: updatedAt,
    uri: uri,
  );
}