null safety

This commit is contained in:
phyothandar
2021-09-10 15:22:11 +06:30
parent 51a5fe0740
commit c90661b262
24 changed files with 194 additions and 193 deletions

View File

@@ -61,16 +61,16 @@ class InvoiceTable extends StatelessWidget {
List<InvoiceTableRow> getTableRows() {
List<InvoiceTableRow> tableRows = [];
// add cargo types
List<CargoType> _cargoTypes = invoice!.getCargoTypes(rate!) ?? [];
List<CargoType> _cargoTypes = invoice!.getCargoTypes(rate!);
_cargoTypes.forEach((c) {
tableRows.add(InvoiceTableRow(
invoiceDataType: InvoiceDataType.CargoDataType,
desc: c.name,
rate:
"${c.calWeight!.toStringAsFixed(2)} x ${c.calRate!.toStringAsFixed(2)}",
"${c.calWeight.toStringAsFixed(2)} x ${c.calRate.toStringAsFixed(2)}",
amount: "${c.calAmount.toStringAsFixed(2)}"));
});
invoice!.shipments.where((ss) => (ss.isSelected ?? false)).forEach((s) {
invoice!.shipments.where((ss) => (ss.isSelected )).forEach((s) {
tableRows.add(InvoiceTableRow(
data: s,
invoiceDataType: InvoiceDataType.HandlingFeeType,
@@ -95,7 +95,7 @@ class InvoiceTable extends StatelessWidget {
invoiceDataType: InvoiceDataType.DeliveryFeeType,
desc: "Delivery fee",
rate: "",
amount: "${invoice?.deliveryFee?.toStringAsFixed(2) ?? '0'}"));
amount: "${invoice?.deliveryFee.toStringAsFixed(2) ?? '0'}"));
// // add discounts
if (invoice!.discount != null) {
@@ -104,7 +104,7 @@ class InvoiceTable extends StatelessWidget {
invoiceDataType: InvoiceDataType.DiscountDataType,
desc: "Discount\n${invoice?.discount?.code ?? ""}",
rate: "",
amount: "(${invoice?.discount?.amount?.toStringAsFixed(2) ?? ''})"));
amount: "(${invoice?.discount?.amount.toStringAsFixed(2) ?? ''})"));
}
return tableRows;