null safety
This commit is contained in:
@@ -91,7 +91,7 @@ class _InvoiceEditorState extends State<InvoiceEditor> {
|
||||
_loadCartons() async {
|
||||
CartonModel cartonModel = Provider.of<CartonModel>(context, listen: false);
|
||||
List<Carton> cartons = await cartonModel.getCartonsForInvoice(
|
||||
widget.fcsShipment!.id, widget.customer!.id);
|
||||
widget.fcsShipment!.id!, widget.customer!.id!);
|
||||
cartons.forEach((c) {
|
||||
c.isChecked = true;
|
||||
});
|
||||
@@ -104,7 +104,7 @@ class _InvoiceEditorState extends State<InvoiceEditor> {
|
||||
ShipmentModel shipmentModel =
|
||||
Provider.of<ShipmentModel>(context, listen: false);
|
||||
List<Shipment> shipments = await shipmentModel.getShipmentWithHandlingFee(
|
||||
widget.fcsShipment!.id, widget.customer!.id);
|
||||
widget.fcsShipment!.id!, widget.customer!.id!);
|
||||
shipments.forEach((s) {
|
||||
s.isSelected = true;
|
||||
});
|
||||
@@ -117,7 +117,7 @@ class _InvoiceEditorState extends State<InvoiceEditor> {
|
||||
_loadDiscount() async {
|
||||
DiscountModel discountModel =
|
||||
Provider.of<DiscountModel>(context, listen: false);
|
||||
discounts = await discountModel.getDiscount(widget.customer!.id);
|
||||
discounts = (await discountModel.getDiscount(widget.customer!.id!))!;
|
||||
if (discounts != null && discounts.length > 0) {
|
||||
setState(() {
|
||||
_invoice!.discount = discounts.first;
|
||||
@@ -281,7 +281,7 @@ class _InvoiceEditorState extends State<InvoiceEditor> {
|
||||
Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Text(dateFormatter.format(_invoice!.invoiceDate)),
|
||||
Text(dateFormatter.format(_invoice!.invoiceDate!)),
|
||||
SizedBox(
|
||||
height: 10,
|
||||
),
|
||||
@@ -429,7 +429,7 @@ class _InvoiceEditorState extends State<InvoiceEditor> {
|
||||
invoice.cargoTypes = cargoTypes;
|
||||
invoice.amount = amount;
|
||||
invoice.handlingFee = _invoice!.getHandlingFee();
|
||||
invoice.cartons = _invoice!.cartons.where((c) => c.isChecked).toList();
|
||||
invoice.cartons = _invoice!.cartons.where((c) => c.isChecked!).toList();
|
||||
invoice.shipments =
|
||||
_invoice!.shipments.where((s) => s.isSelected).toList();
|
||||
invoice.discount = _invoice!.discount;
|
||||
|
||||
Reference in New Issue
Block a user