flutter dialog prevent close code example
Example 1: flutter close dialog
showDialog(
context: context,
builder: (_) {
return AlertDialog(
title: Text('Wanna Exit?'),
actions: [
FlatButton(
onPressed: () => Navigator.pop(context, false),
child: Text('No'),
),
FlatButton(
onPressed: () => Navigator.pop(context, true),
child: Text('Yes'),
),
],
);
}).then((exit) {
if (exit == null) return;
if (exit) {
} else {
}
});
Example 2: flutter dialog prevent close
showDialog(
barrierDismissible: false,
builder: ...
)