null safety
This commit is contained in:
@@ -37,11 +37,11 @@ class _DiscountEditorState extends State<DiscountEditor> {
|
||||
super.initState();
|
||||
if (widget.discount != null) {
|
||||
_discount = widget.discount!;
|
||||
_codeController.text = _discount.code;
|
||||
_codeController.text = _discount.code ?? "";
|
||||
_amountController.text = _discount.amount.toStringAsFixed(2);
|
||||
_statusController.text = _discount.status;
|
||||
customerName = _discount.customerName;
|
||||
customerId = _discount.customerId;
|
||||
_statusController.text = _discount.status ?? '';
|
||||
customerName = _discount.customerName ?? "";
|
||||
customerId = _discount.customerId ?? "";
|
||||
} else {
|
||||
_isNew = true;
|
||||
}
|
||||
@@ -77,8 +77,8 @@ class _DiscountEditorState extends State<DiscountEditor> {
|
||||
icon: Icon(Icons.search, color: primaryColor),
|
||||
onPressed: () => searchUser(context, onUserSelect: (u) {
|
||||
setState(() {
|
||||
customerId = u.id;
|
||||
customerName = u.name;
|
||||
customerId = u.id ?? "";
|
||||
customerName = u.name ?? "";
|
||||
});
|
||||
},popPage: true)),
|
||||
],
|
||||
|
||||
Reference in New Issue
Block a user