final
This commit is contained in:
@@ -7,18 +7,18 @@ import 'cart_line_item.dart';
|
||||
import 'extra_fee.dart';
|
||||
|
||||
class CartInfo {
|
||||
int id;
|
||||
double originPrice;
|
||||
double discountPrice;
|
||||
double totalPrice;
|
||||
Business businessInfo;
|
||||
List<CartLineItem> productList;
|
||||
List<ExtraFee> extraFeeList;
|
||||
List<ExtraFee> discountList;
|
||||
int deliveryMethod;
|
||||
String shippingMethod;
|
||||
double amountPaid;
|
||||
String extraData;
|
||||
int? id;
|
||||
double? originPrice;
|
||||
double? discountPrice;
|
||||
double? totalPrice;
|
||||
Business? businessInfo;
|
||||
List<CartLineItem>? productList;
|
||||
List<ExtraFee>? extraFeeList;
|
||||
List<ExtraFee>? discountList;
|
||||
int? deliveryMethod;
|
||||
String? shippingMethod;
|
||||
double? amountPaid;
|
||||
String? extraData;
|
||||
|
||||
CartInfo.fromJson(Map<String, dynamic> json)
|
||||
: id = json['id'],
|
||||
@@ -53,7 +53,7 @@ class CartInfo {
|
||||
if (productList == null) {
|
||||
productList = [item];
|
||||
} else {
|
||||
productList.add(item);
|
||||
productList!.add(item);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -74,19 +74,19 @@ class CartInfo {
|
||||
originPrice = 0.0;
|
||||
discountPrice = 0.0;
|
||||
totalPrice = 0.0;
|
||||
for (var i = 0; i < productList.length; i++) {
|
||||
newTotal += productList[i].getTotalPrice();
|
||||
for (var i = 0; i < productList!.length; i++) {
|
||||
newTotal += productList![i].getTotalPrice();
|
||||
}
|
||||
originPrice = newTotal;
|
||||
totalPrice = newTotal;
|
||||
return totalPrice;
|
||||
return totalPrice!;
|
||||
}
|
||||
|
||||
int getProductListTotalQuantity() {
|
||||
int qty = 0;
|
||||
if (productList != null && productList.length > 0) {
|
||||
for (var i = 0; i < productList.length; i++) {
|
||||
qty += productList[i].quantity.round();
|
||||
if (productList != null && productList!.length > 0) {
|
||||
for (var i = 0; i < productList!.length; i++) {
|
||||
qty += productList![i].quantity!.round();
|
||||
}
|
||||
}
|
||||
return qty;
|
||||
|
||||
Reference in New Issue
Block a user