Want to check whether Alert Dialog is open in flutter? First thing is you will be showing dialog yourself. So, you can use a bool value to track it.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 | bool _isDialogShowing = false; void _showDialog() { _isDialogShowing = true; // set it `true` since dialog is being displayed showDialog( context: context, builder: (context) { return AlertDialog( title: Text("Title"), actions: <Widget>[ FlatButton( child: Text("CANCEL"), onPressed: () { _isDialogShowing = false; // set it `false` since dialog is closed Navigator.of(context).pop(); }, ) ], ); }, ); } |
If you like this question & answer and want to contribute, then write your question & answer and email to freewebmentor[@]gmail.com. Your question and answer will appear on FreeWebMentor.com and help other developers.