showAlertDialog(BuildContext context, AlertDialog alert, bool dismissible) {
if (isDialogOpened!) {
Navigator.pop(context);
isDialogOpened = false;
}
showDialog(
barrierDismissible: dismissible,
context: context,
builder: (BuildContext context) {
isDialogOpened = true;
return alert;
},
).then((_) => isDialogOpened = false);
}
This method is inside a controller of mine that I call AlertController, in mine I don't know what would be the best approach for me to be able to do my tests with this method.