title: setstate doesn't work with showdialog and alertdialog
body: <p>Using a <strong>stateful</strong> widget and <strong>setstate</strong> with <strong>showdialog</strong> and <strong>alertdialog</strong> seems to not work properly in my code but for simplification i simulated the same issue with smaller and simpler code here for more problem understanding</p>
  <pre><code>import 'package:flutter/material.dart';
  import '../widgets/app_drawer.dart';
  
  class Test extends StatefulWidget {
  
    @override
    State&lt;Test&gt; createState() =&gt; _TestState();
  }
  
  class _TestState extends State&lt;Test&gt; {
  
    int x = 0;
    @override
    Widget build(BuildContext context) {
      return Scaffold(
        drawer: AppDrawer(),
        appBar: AppBar(
          title: Text(&quot;Shop&quot;),
        ),
        body: Column(
          children: [
            RaisedButton(
              onPressed: () {
                showDialog(
                  context: context,
                  builder: (ctx) =&gt; AlertDialog(
                    title: Text(&quot;hey&quot;),
                    content: Text(x.toString()),
                    actions: [
                      RaisedButton(
                        onPressed: () {},
                        child: Text(&quot;click me&quot;),
                      ),
                      RaisedButton(
                        onPressed: () {
                          setState(() {
                            x++;
                          });
                        },
                        child: Text(&quot;increment&quot;),
                      )
                    ],
                  ),
                );
              },
              child: Text(&quot;Click&quot;),
            ),
            Text(x.toString()),
          ],
        ),
      );
    }
  }
  </code></pre>
  <p>if you run this piece of code you will notice the number increasing in the background but not on the popup dialog and to see the change you have to close the dialog and reopen it to see the latest value
  the actual code (the not simplified version) is based on the same idea but a little different</p>
  <p>the idea is based on a shop order where you see your cart with products and when you click on edit cart products a popup dialog appears with the previous values for the products and can remove or add products from the cart and click on Update button.
  the <strong>onPressed</strong> value for the button can be a function which approves the new cart if the products list is not null and can be null (disabled button) if you removed all products from the cart but it doesn't seem to work immediately.
  the button looks something like this</p>
  <pre><code>RaisedButton(
    onPressed: orderCart.isEmpty
    ? null
    : () {
         //Function here
      },
    child: Text(
         &quot;Update&quot;,
        ),
    ),
  </code></pre>