copyWith method

Product copyWith({
  1. String? brand,
  2. String? category,
  3. Money? cost,
  4. String? description,
  5. String? id,
  6. String? name,
  7. Country? origin,
  8. Money? price,
})

Creates a copy of this Product instance where the only changes are those specified in the parameters of this method.

Implementation

Product copyWith({
  String? brand,
  String? category,
  Money? cost,
  String? description,
  String? id,
  String? name,
  Country? origin,
  Money? price,
}) =>
    Product(
      brand: brand ?? this.brand,
      category: category ?? this.category,
      cost: cost ?? this.cost,
      description: description ?? this.description,
      id: id ?? this.id,
      name: name ?? this.name,
      origin: origin ?? this.origin,
      price: price ?? this.price,
    );