Problem
I’m showing an AlertDialog on my App, but when I click on no/cancel then AlertDialog doesn’t dismiss, it keep popping the route where I came from. I’ve used Navigator.of(context).pop();
and Navigator.pop(context, false);
but both are not working.
Solution
To Dismiss an AlertDialog Navigator.of(context).pop(); works but in my case below code worked.
Navigator.of(context, rootNavigator: true).pop('dialog');
That’s All.
Thanks for reading.
Keep Coding.