title: Flutter: bloc, how to show an alert dialog
body: <p>I´m new in the bloc pattern and stream stuff. I want to show up an alert dialog when I press a button, but I can´t find a way to do it. Actually my code is:</p>
  
  <pre><code>Widget button() {
    return RaisedButton(
        child: Text('Show alert'),
        color: Colors.blue[700],
        textColor: Colors.white,
        onPressed: () {
          bloc.submit();
        });
     }
  
  
  
  return Scaffold(
          appBar: AppBar(
            title: Text("Title"),
          ),
          body: StreamBuilder(
              stream: bloc.getAlert,
              builder: (context, snapshot) {
                if (snapshot.hasData) {
                  return Text("I have Dataaaaaa ${snapshot.data}");
                } else
                  return ListView(
                    children: &lt;Widget&gt;[
                      Container(
                       button()
                      )
                  ...
  </code></pre>
  
  <p>And the BLoC:</p>
  
  <pre><code>final _submissionController = StreamController();
  Stream get submissionStream=&gt; _submissionController.stream;
  Sink get submissionSink=&gt; _submissionController.sink;
  </code></pre>
  
  <p>I tried to do something like:</p>
  
  <pre><code>Widget button() {
    return StreamBuilder(
  stream: submissionStream
  builder: (context, snapshot){
  if (snapshot.hasData){
  return showDialog(...)
  }else
   return RaisedButton(
        child: Text('Show alert'),
        color: Colors.blue[700],
        textColor: Colors.white,
        onPressed: () {
          bloc.submit();
        });
     }
  </code></pre>
  
  <p>But, of course, it didn´t work.</p>