copyWithCompanion method

ProductData copyWithCompanion(
  1. ProductCompanion data
)

Implementation

ProductData copyWithCompanion(ProductCompanion data) {
  return ProductData(
    id: data.id.present ? data.id.value : this.id,
    name: data.name.present ? data.name.value : this.name,
    price: data.price.present ? data.price.value : this.price,
    active: data.active.present ? data.active.value : this.active,
    imagePath: data.imagePath.present ? data.imagePath.value : this.imagePath,
    categoryId: data.categoryId.present
        ? data.categoryId.value
        : this.categoryId,
    estimatedInputPrice: data.estimatedInputPrice.present
        ? data.estimatedInputPrice.value
        : this.estimatedInputPrice,
    taxRate: data.taxRate.present ? data.taxRate.value : this.taxRate,
    description: data.description.present
        ? data.description.value
        : this.description,
  );
}