<p dir="auto">Internal: b/140829693</p>
<p dir="auto">We frequently have a need for a <code class="notranslate">StreamBuilder</code> type widget in our app (mulligan) but there's a major issue with it that prevents us from using it: if the stream has an initial value when the widget is first built, the widget will still be built with a no data frame before the widget is built with a data frame. This results in jank that we cannot have in our app.</p>
<p dir="auto">The sequence of events seems to be the following today:</p>
<ol dir="auto">
<li><code class="notranslate">StreamBuilder</code> constructor is called.</li>
<li><code class="notranslate">StreamBuilder</code> state is created. The current snapshot is set to the loading snapshot.</li>
<li><code class="notranslate">StreamBuilder</code> state's <code class="notranslate">initState</code> method is called. Stream is listened to.</li>
<li><code class="notranslate">StreamBuilder</code> state's <code class="notranslate">build</code> method is called with the loading snapshot.</li>
<li><code class="notranslate">StreamBuilder</code> state's stream listener is invoked. <code class="notranslate">setState</code> is called with the data snapshot and the widget is rebuilt.</li>
</ol>
<p dir="auto">As far as I understand, the problem is that when you listen to a <code class="notranslate">Stream</code> in Dart, it doesn't fire the callback synchronously. Because of this, I'm not sure if there's anything that can be done to resolve this issue. That said, until this gets fixed, I think that <code class="notranslate">StreamBuilder</code> is unusable in this use case. To start discussion, does Flutter perform the steps from 2-4 in the same run-loop?</p>
<p dir="auto">Here's a test that depicts the problem I'm discussing: <a href="https://gist.github.com/alanrussian/d4a0d8c779275832dad44d4acde9cc59">https://gist.github.com/alanrussian/d4a0d8c779275832dad44d4acde9cc59</a></p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="[!] Android Studio (version 2.3)
X Unable to find bundled java version
[V] Android Studio (version 3.0) "><pre class="notranslate"><code class="notranslate">[!] Android Studio (version 2.3)
X Unable to find bundled java version
[V] Android Studio (version 3.0) 
</code></pre></div>
<p dir="auto">Do I have to install Android Studio 2.3 too? The files are not available anymore on google developer's site.<br>
Tks in advance! ;)</p>