null safety

This commit is contained in:
phyothandar
2021-09-10 17:14:59 +06:30
parent 4f7aa1b252
commit 2c95ec7600
21 changed files with 54 additions and 51 deletions

View File

@@ -103,10 +103,10 @@ class _InvoiceEditorState extends State<InvoiceEditor> {
_loadShipments() async {
ShipmentModel shipmentModel =
Provider.of<ShipmentModel>(context, listen: false);
List<Shipment> shipments = await shipmentModel.getShipmentWithHandlingFee(
List<Shipment?>? shipments = await shipmentModel.getShipmentWithHandlingFee(
widget.fcsShipment!.id!, widget.customer!.id!);
shipments.forEach((s) {
s.isSelected = true;
shipments!.forEach((s) {
s!.isSelected = true;
});
setState(() {
_invoice!.shipments = shipments;
@@ -380,8 +380,8 @@ class _InvoiceEditorState extends State<InvoiceEditor> {
if (shipment == null) return;
shipment.isSelected = true;
setState(() {
_invoice!.shipments.remove(shipment);
_invoice!.shipments.add(shipment);
_invoice!.shipments!.remove(shipment);
_invoice!.shipments!.add(shipment);
});
}
@@ -389,8 +389,8 @@ class _InvoiceEditorState extends State<InvoiceEditor> {
if (shipment == null) return;
shipment.isSelected = false;
setState(() {
_invoice!.shipments.remove(shipment);
_invoice!.shipments.add(shipment);
_invoice!.shipments!.remove(shipment);
_invoice!.shipments!.add(shipment);
});
}
@@ -431,7 +431,7 @@ class _InvoiceEditorState extends State<InvoiceEditor> {
invoice.handlingFee = _invoice!.getHandlingFee();
invoice.cartons = _invoice!.cartons.where((c) => c.isChecked!).toList();
invoice.shipments =
_invoice!.shipments.where((s) => s.isSelected).toList();
_invoice!.shipments!.where((s) => s!.isSelected).toList();
invoice.discount = _invoice!.discount;
invoice.deliveryFee = _invoice!.deliveryFee;