check null safety for delivery
This commit is contained in:
@@ -64,9 +64,8 @@ class Carton {
|
||||
// String get packageNumber =>
|
||||
// shipmentNumber + "-" + receiverNumber + " #" + boxNumber;
|
||||
|
||||
double get actualWeight => cargoTypes == null
|
||||
? 0
|
||||
: cargoTypes.fold(0, (p, e) => e.weight + p);
|
||||
double get actualWeight =>
|
||||
cargoTypes == null ? 0 : cargoTypes.fold(0, (p, e) => e.weight + p);
|
||||
|
||||
int getShipmentWeight(double volumetricRatio) {
|
||||
if (length == null ||
|
||||
@@ -115,8 +114,8 @@ class Carton {
|
||||
|
||||
double total = 0;
|
||||
cargoTypes.forEach((e) {
|
||||
double r = e.rate -
|
||||
(discountByWeight != null ? (discountByWeight.discount) : 0);
|
||||
double r =
|
||||
e.rate - (discountByWeight != null ? (discountByWeight.discount) : 0);
|
||||
double amount = e.weight * r;
|
||||
total += amount;
|
||||
});
|
||||
@@ -194,7 +193,8 @@ class Carton {
|
||||
}
|
||||
|
||||
factory Carton.fromMap(Map<String, dynamic> map, String docID) {
|
||||
var _arrivedDate = (map['arrived_date'] as Timestamp);
|
||||
var _arrivedDate =
|
||||
map['arrived_date'] == null ? null : (map['arrived_date'] as Timestamp);
|
||||
var da = map['delivery_address'];
|
||||
var _da = da != null ? DeliveryAddress.fromMap(da, da["id"]) : null;
|
||||
var cargoTypesMaps =
|
||||
|
||||
Reference in New Issue
Block a user