36 lines
742 B
Dart
36 lines
742 B
Dart
/// A parsed receipt row shown on the review screen.
|
|
library;
|
|
|
|
class LineItem {
|
|
LineItem({
|
|
required this.id,
|
|
required this.name,
|
|
required this.price,
|
|
this.quantity,
|
|
this.unitPrice,
|
|
});
|
|
|
|
final String id;
|
|
final String name;
|
|
final double price;
|
|
final int? quantity;
|
|
final double? unitPrice;
|
|
|
|
LineItem copyWith({
|
|
String? id,
|
|
String? name,
|
|
double? price,
|
|
int? quantity,
|
|
double? unitPrice,
|
|
bool clearQuantity = false,
|
|
}) {
|
|
return LineItem(
|
|
id: id ?? this.id,
|
|
name: name ?? this.name,
|
|
price: price ?? this.price,
|
|
quantity: clearQuantity ? null : (quantity ?? this.quantity),
|
|
unitPrice: clearQuantity ? null : (unitPrice ?? this.unitPrice),
|
|
);
|
|
}
|
|
}
|