Dialog ReOpen with back button

Anyone know how to avoid this?

Make sure you pop the dialog befor pushing the next screen.

Navigator.pop(context); // close dialog
Navigator.push(nextScreen);

2 Likes

This was the problem, thanks

1 Like

showDialog(
context: context,
barrierDismissible: false,
builder: (BuildContext context) {
return WillPopScope(
onWillPop: () async => false,
child: AlertDialog(
title: Text(‘Title’),
content: Text(‘This is Demo’),
actions: [
FlatButton(
onPressed: () => Navigator.pop(context),
child: Text(‘Go Back’),
),],),);},);