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,
}) {
return Order(
items: items ?? this.items,
subtotal: subtotal ?? this.subtotal,
tax: tax ?? this.tax,
total: total ?? this.total,
);
}