null safety
This commit is contained in:
@@ -28,7 +28,7 @@ class Invoice {
|
||||
List<CustomDuty> customDuties;
|
||||
List<Carton> cartons;
|
||||
List<CargoType> cargoTypes;
|
||||
List<Shipment> shipments;
|
||||
List<Shipment?>? shipments;
|
||||
List<Payment> payments;
|
||||
Discount? discount;
|
||||
PaymentMethod? paymentMethod;
|
||||
@@ -85,9 +85,9 @@ class Invoice {
|
||||
}
|
||||
|
||||
double getHandlingFee() {
|
||||
return shipments
|
||||
.where((sh) => sh.isSelected)
|
||||
.fold(0, (p, s) => p + (s.handlingFee - s.paidHandlingFee));
|
||||
return shipments!
|
||||
.where((sh) => sh!.isSelected)
|
||||
.fold(0, (p, s) => p + (s!.handlingFee - s.paidHandlingFee));
|
||||
}
|
||||
|
||||
double getTotalBalance(Rate rate) {
|
||||
@@ -176,7 +176,7 @@ class Invoice {
|
||||
List _cargoTypes = cargoTypes.map((c) => c.toMap()).toList();
|
||||
List _customDuties = customDuties.map((c) => c.toMap()).toList();
|
||||
List _cartons = cartons.map((c) => c.toMap()).toList();
|
||||
List _shipments = shipments.map((s) => s.toMap()).toList();
|
||||
List _shipments = shipments!.map((s) => s!.toMap()).toList();
|
||||
return {
|
||||
"id": id,
|
||||
"invoice_date": invoiceDate?.toUtc().toIso8601String(),
|
||||
|
||||
@@ -36,7 +36,7 @@ class Package {
|
||||
DeliveryAddress? deliveryAddress;
|
||||
|
||||
//for packages in processing
|
||||
List<File> photoFiles;
|
||||
List<File?> photoFiles;
|
||||
|
||||
int get amount => rate != null && weight != null ? rate * weight : 0;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user