copyWith method
Returns a copy of this Order object with the given fields replaced by new values.
This can be useful when you want to create a modified version of an existing order without changing the original object.
Implementation
Order copyWith({
List<Item>? items,
double? subtotal,
double? tax,
double? total,
String? invoiceNumber,
String? date,
String? paymentMethod,
}) {
return Order(
date: date ?? this.date,
invoiceNumber: invoiceNumber ?? this.invoiceNumber,
paymentMethod: paymentMethod ?? this.paymentMethod,
items: items ?? this.items,
subtotal: subtotal ?? this.subtotal,
tax: tax ?? this.tax,
total: total ?? this.total,
);
}