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;

View File

@@ -9,7 +9,7 @@ typedef OnAdd(Shipment shipment);
typedef OnRemove(Shipment shipment);
class InvoiceHandlingFeeList extends StatelessWidget {
final List<Shipment>? shipments;
final List<Shipment?>? shipments;
final OnAdd? onAdd;
final OnRemove? onRemove;
@@ -72,7 +72,7 @@ class InvoiceHandlingFeeList extends StatelessWidget {
onSelectChanged: (value) => Navigator.pop(context, c),
cells: [
MyDataCell(new Text(
c.shipmentNumber!,
c!.shipmentNumber!,
style: textStyle,
)),
MyDataCell(