I have async function in a Flutter widget that will perform these steps:
Future<void> someFunction(BuildContext context) async {
// step 1:
// call async function that will result in removing current widget from the tree.
await foo();
// at this point the context has no widget since the widget is removed from the tree
// step 2:
// need to show a dialog which requires a context with a widget.
// since the context has no widget, I am unable to show the dialog
// What can we do here??
showDialog(context: context, .....);
}
Can someone suggest a solution. Thanks