Flutter Navigator.of(context).pop() in showDialog, close full app in ios


i have a problem in the ios version of my app, this is the code.

void showErrorAlert(BuildContext context, String msj) {
    context: context,
    builder: (context) {
      return AlertDialog(
        title: Text('Error'),
        content: Text(msj),
        actions: [
            onPressed: () => Navigator.of(context).pop(),
            child: Text('ok'),

the Navigator.of(context).pop() in android works perfect, close the dialog and everything is ok, but in ios, the full app is closed when that code is called ‘Navigator.of(context).pop()’, someone know what can i do to close only the dialog in ios?

P.D.: i dont have any error or warning in the output console, even when te app get closed
P.D.2: i already tried change the .pop to this ‘Navigator.of(context, rootNavigator: true).pop(‘dialog’)’ but it doesnt work


Try switching to the stable branch because it is a reported bug. Use

flutter channel stable


Damn it this answer got saved as a draft and I closed my laptop. I just realized you had already solved it

Answered By – Siddharth Agrawal

Answer Checked By – Gilberto Lyons (FlutterFixes Admin)

Leave a Reply

Your email address will not be published. Required fields are marked *