title: Flutter Performance - SetState vs StreamBuilder
body: <p>In Flutter, which way has the more performance over high load handling?</p>
  
  <p>Let's say that we are listening to a stream which emits around 1000 msgs per second. Which way will have more performance?</p>
  
  <p>1) Using setState() like</p>
  
  <pre><code>stream.listen((msg) =&gt; setState(() =&gt; _msg = msg)
  </code></pre>
  
  <p>then in the build method</p>
  
  <pre><code>return Text(_msg);
  </code></pre>
  
  <p>2) Using stream builder</p>
  
  <pre><code>StreamBuilder(
                stream: stream,
                builder: (context, snapshot) {
                  if (snapshot.hasData) {
                    return Text(snapshot.data)
                    );
                  }
                },
              )),
  </code></pre>