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.
Latest posts by Sushant K (see all)
- [SOLVED] Flutter : Waiting for another flutter command to release the startup lock. - July 2, 2021
- How to Change Passport Token length in laravel. - June 12, 2021
- Flutter : How to dismiss an AlertDialog on Button? - June 7, 2021