title: How to control Stream (start, pause, resume) in Streambuilder
body: <p>I want to three-row share one stream and each row can pause and resume.</p>
  
  <p>Now, I just can using <code>StreamController</code> and <code>StreamBuilder</code> share one stream to three-row, but I don't know how to pause and resume.</p>
  
  <p><a href="https://i.stack.imgur.com/Zsb98.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/Zsb98.png" alt="enter image description here"></a></p>
  
  <p><a href="https://github.com/WingCH/Fluuter-Exercise" rel="nofollow noreferrer">https://github.com/WingCH/Fluuter-Exercise</a></p>
  
  <pre class="lang-dart prettyprint-override"><code>...
  class StreamDemoState extends State&lt;StreamDemo&gt; {
    StreamController _streamController;
    Stream&lt;int&gt; timerStream;
  
    @override
    void initState() {
      super.initState();
  
      //Timer
      Duration interval = Duration(seconds: 1);
      timerStream = Stream.periodic(interval, (data) {
        return data;
      });
  
      _streamController = StreamController.broadcast();
      _streamController.addStream(timerStream);
    }
    Widget build(BuildContext context) {
  ...
      Padding(
              padding: EdgeInsets.all(10),
              child: StreamBuilder&lt;Object&gt;(
                  stream: _streamController.stream,
                  builder: (context, snapshot) {
                    if (snapshot.hasData) {
                      return Column(
                        children: &lt;Widget&gt;[
                          Text(
                            snapshot.data.toString(),
                            style: TextStyle(
                                color: Colors.blueGrey,
                                fontWeight: FontWeight.bold,
                                fontSize: 80),
                          ),
                          Row(
                            mainAxisAlignment: MainAxisAlignment.center,
                            children: &lt;Widget&gt;[
                              OutlineButton(
                                onPressed: () {
                                  //listen / resume
                                },
                                child: Text('listen'),
                              ),
                              Padding(
                                padding:
                                    const EdgeInsets.symmetric(horizontal: 20.0),
                                child: OutlineButton(
                                  onPressed: () {
                                    //Pause
                                  },
                                  child: Text('Paused'),
                                ),
                              ),
                              OutlineButton(
                                onPressed: null,
                                child: Text('--'),
                              ),
                            ],
                          )
                        ],
                      );
                    } else {
                      return Text('no Date');
                    }
                  }),
            ),
  ...
    }
  
  </code></pre>