My action is as follows:
-On tap of button:
-Backend API call to custom API, to get Qty and Qty on hand. (apiGetPanelQty). Non-blocking off.
-On success, custom action to convert json $.qty and $.qtyOH string to double.
-Then conditional check if the formattedQty <= formattedQtyOH.
-If False, then i would like to show Alert dialog Confirm Dialog.
The dialog fail to show, because BuildContext is no longer valid.
Here is the console log from chrome:
Uncaught (in promise) DartError: This BuildContext is no longer valid.
The showDialog function context parameter is a BuildContext that is no longer valid.
This can commonly occur when the showDialog function is called after awaiting a Future. In this situation the BuildContext might refer to a widget that has already been disposed during the await. Consider using a parent context instead.
Please help as I am in the middle of project. Thank you.