null safety

This commit is contained in:
Phaung Phaung
2021-09-10 15:23:13 +06:30
parent 5c5e47b9ad
commit 376153e22f
14 changed files with 80 additions and 66 deletions

View File

@@ -49,16 +49,19 @@ class _FcsShipmentEditorState extends State<FcsShipmentEditor> {
_isNew = widget.shipment == null;
if (widget.shipment != null) {
_shipment = widget.shipment!;
_shipmentNumberController.text = _shipment.shipmentNumber;
_cutoffDateController.text = dateFormatter.format(_shipment.cutoffDate);
_arrivalDateController.text = dateFormatter.format(_shipment.arrivalDate);
_shipmentNumberController.text = _shipment.shipmentNumber ?? "";
if(_shipment.cutoffDate != null)
_cutoffDateController.text = dateFormatter.format(_shipment.cutoffDate!);
if(_shipment.arrivalDate != null)
_arrivalDateController.text = dateFormatter.format(_shipment.arrivalDate!);
if(_shipment.departureDate != null)
_departureDateControler.text =
dateFormatter.format(_shipment.departureDate);
_statusController.text = _shipment.status;
dateFormatter.format(_shipment.departureDate!);
_statusController.text = _shipment.status ?? "";
_currentShipmentType = _shipment.shipType;
_consigneeController.text = _shipment.consignee;
_portController.text = _shipment.port;
_destinationController.text = _shipment.destination;
_consigneeController.text = _shipment.consignee ?? "";
_portController.text = _shipment.port ?? "";
_destinationController.text = _shipment.destination ?? "";
} else {
var mainModel = Provider.of<MainModel>(context, listen: false);
_currentShipmentType = mainModel.setting.shipmentTypes[0];