https://stackoverflow.com/questions/50683524/how-to-dismiss-flutter-dialog Navigator.of(context, rootNavigator: true).pop();
The dialog route created by this method is pushed to the root navigator. If the application has multiple Navigator objects, it may be necessary to call Navigator.of(context, rootNavigator: true).pop(result)
to close the dialog rather just Navigator.pop(context, result)
.