title: How to return bool value with navigator.pop?
body: <p>I'm trying to return a bool value from the dialogbox but I do not understand why the value does not return as need. I have tried returning as a future value and returning the values together with context after popping the dialogbox.</p>
  
  <pre><code>final bool delete = await _showDialog();
  print(delete);
  
  Future&lt;bool&gt; _showDialog() {
  bool result;
  
  showDialog(
    context: context,
    builder: (BuildContext context) {
      return AlertDialog(
        title: Text('Delete Appointment'),
        content: Text(
          'Are you sure? \nThis action cannot undo.',
          style: TextStyle(
            color: Colors.red,
            fontSize: 20
          ),
        ),
        actions: &lt;Widget&gt;[
          FlatButton(
            color: Colors.blue,
            child: Text(
              'CANCEL',
              style: TextStyle(
                color: Colors.white,
                fontSize: 20
              ),
            ),
            onPressed: () {
              setState(() =&gt; result = false);
              //print(result);
              Navigator.pop(context, result);
              return Future.value(result);
            },
          ),
          SizedBox(
            width: 50,
          ),
          FlatButton(
            color: Colors.red,
            child: Text(
              'CONFIRM',
              style: TextStyle(
                color: Colors.white,
                fontSize: 20
              ),
            ),
            onPressed: () {
              setState(() =&gt; result = true);
              //print(result);
              Navigator.pop(context, result);
              return Future.value(result);
            },
          )
        ],
      );
    }
  );
  }
  </code></pre>