parser logic added
This commit is contained in:
@@ -8,20 +8,27 @@ class LineItem {
|
||||
required this.price,
|
||||
this.quantity,
|
||||
this.unitPrice,
|
||||
this.discount = 0,
|
||||
});
|
||||
|
||||
final String id;
|
||||
final String name;
|
||||
|
||||
/// Line total after any discount.
|
||||
final double price;
|
||||
final int? quantity;
|
||||
final double? unitPrice;
|
||||
|
||||
/// Negative amount when a discount was folded into [price].
|
||||
final double discount;
|
||||
|
||||
LineItem copyWith({
|
||||
String? id,
|
||||
String? name,
|
||||
double? price,
|
||||
int? quantity,
|
||||
double? unitPrice,
|
||||
double? discount,
|
||||
bool clearQuantity = false,
|
||||
}) {
|
||||
return LineItem(
|
||||
@@ -30,6 +37,7 @@ class LineItem {
|
||||
price: price ?? this.price,
|
||||
quantity: clearQuantity ? null : (quantity ?? this.quantity),
|
||||
unitPrice: clearQuantity ? null : (unitPrice ?? this.unitPrice),
|
||||
discount: discount ?? this.discount,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user