check null safety
This commit is contained in:
@@ -31,7 +31,7 @@ class _CargoEditorState extends State<CargoEditor> {
|
||||
super.initState();
|
||||
if (widget.cargo != null) {
|
||||
_cargo = widget.cargo!;
|
||||
_descController.text = _cargo.name;
|
||||
_descController.text = _cargo.name ?? "";
|
||||
_rateController.text = _cargo.rate.toStringAsFixed(2);
|
||||
} else {
|
||||
_isNew = true;
|
||||
@@ -138,7 +138,7 @@ class _CargoEditorState extends State<CargoEditor> {
|
||||
try {
|
||||
var shipmentRateModel =
|
||||
Provider.of<ShipmentRateModel>(context, listen: false);
|
||||
await shipmentRateModel.deleteCargoType(this._cargo.id);
|
||||
await shipmentRateModel.deleteCargoType(this._cargo.id!);
|
||||
Navigator.pop(context);
|
||||
} catch (e) {
|
||||
showMsgDialog(context, "Error", e.toString());
|
||||
|
||||
Reference in New Issue
Block a user