title: Detect back button press while dialog is open in flutter
body: <p>I am creating an app in a flutter in which I need to display an alert dialog. And this is not a dismissible dialog. But when I press the back button on android it is getting dismissed. I have tried using WillPopScope widget to detect back press events. I am able to detect back button press using WillPopScope but this is not working while the dialog is open. Any suggestion and guide will be really helpful. Thanks.</p>
  <p>Dialog creation snippet:</p>
  <pre><code>void buildMaterialDialog(
    String dialogTitle,
    String dialogContent,
    String negativeBtnText,
    String positiveBtnText,
    String positiveTextUri) {
  
  showDialog(
      context: context,
      barrierDismissible: false,
      builder: (BuildContext context) {
        return new AlertDialog(
          title: new Text(dialogTitle),
          content: new Text(dialogContent),
          actions: &lt;Widget&gt;[
            new FlatButton(
              onPressed: () {
                //Function called
                _updateDialogNegBtnClicked(isCancelable);
              },
              child: new Text(negativeBtnText),
            ),
            new FlatButton(
              onPressed: () =&gt; launch(positiveTextUri),
              child: new Text(positiveBtnText),
            ),
          ],
        );
      });}
  </code></pre>