title: Why does CircularProgressIndicator() not spin?
body: <p>I'm trying to display a <code>CircularProgressIndicator()</code> under a <code>StreamBuilder()</code>. This <code>CircularProgressIndicator()</code> should only show when when <code>snapshot.connectionState != ConnectionState.active</code>.</p>
  <p>Here is the problem. My app tries to show the spinning circle but for some reason freezes. It doesn't spin. Also, the StreamBuilder stop creating any new events. It gets stuck on <code>ConnectionState.waiting</code>. The only thing I can do to fix it is to <strong>press Hot Restart</strong>. When I do that, everything works! The circle spins and eventually, the ConnectionState becomes active and the app moves on! It's driving me insane.</p>
  <p>Here is a photo of the frozen circle (basically just a pink dot in the middle of the screen). I'm assuming only the first frame is drawn but I'm not sure what's going on here, to be honest. I've heard it's called the 'dot effect'.</p>
  <p>What's interesting is that when I replace <code>CircularProgressIndicator()</code> with <code>Text('Loading...')</code> to indicate to the user that the app is loading, everything works perfectly. It's only the circle causing these issues.</p>
  <p><a href="https://i.stack.imgur.com/YMsIi.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/YMsIi.png" alt="enter image description here" /></a></p>
  <pre><code>Flutter Doctor
  [√] Flutter (Channel beta, 1.19.0-4.3.pre, on Microsoft Windows [Version 10.0.18363.900], locale en-US)
      • Flutter version 1.19.0-4.3.pre at C:\Programs\flutter
      • Framework revision 8fe7655ed2 (13 days ago), 2020-07-01 14:31:18 -0700
      • Engine revision 9a28c3bcf4
      • Dart version 2.9.0 (build 2.9.0-14.1.beta)
  
  [√] Android toolchain - develop for Android devices (Android SDK version 29.0.2)
      • Android SDK at C:/Users/Kraken/AppData/Local/Android/Sdk
      • Platform android-29, build-tools 29.0.2
      • ANDROID_HOME = C:/Users/Kraken/AppData/Local/Android/Sdk
      • Java binary at: C:\Program Files\Android\Android Studio\jre\bin\java
      • Java version OpenJDK Runtime Environment (build 1.8.0_242-release-1644-b01)
      • All Android licenses accepted.
  
  [√] Chrome - develop for the web
      • Chrome at C:\Program Files (x86)\Google\Chrome\Application\chrome.exe
  
  [√] Android Studio (version 4.0)
      • Android Studio at C:\Program Files\Android\Android Studio
      • Flutter plugin version 47.1.2
      • Dart plugin version 193.7361
      • Java version OpenJDK Runtime Environment (build 1.8.0_242-release-1644-b01)
  
  [√] VS Code, 64-bit edition (version 1.47.0)
      • VS Code at C:\Program Files\Microsoft VS Code
      • Flutter extension version 3.11.0
  
  [√] Connected device (3 available)
      • AOSP on IA Emulator • emulator-5554 • android-x86    • Android 9 (API 28) (emulator)
      • Web Server          • web-server    • web-javascript • Flutter Tools
      • Chrome              • chrome        • web-javascript • Google Chrome 83.0.4103.116
  
  • No issues found!
  </code></pre>
  <hr />
  <p>I've managed to create a simple snippet that recreates this issue on the Android emulator on Windows. You can try it yourself. The issue happens after you click run. And clicking hot restart will fix it.</p>
  <pre><code>import 'package:flutter/material.dart';
  import 'dart:async';
  
  void main() {
    runApp(MyApp());
  }
  
  class MyApp extends StatelessWidget {
    @override
    Widget build(BuildContext context) {
      return MaterialApp(home: MyWidget());
    }
  }
  
  class MyWidget extends StatelessWidget {
    @override
    Widget build(BuildContext context) {
      return StreamBuilder&lt;int&gt;(
          stream: StreamController&lt;int&gt;().stream,
          builder: (context, snapshot) {
            print('$snapshot');
            return Scaffold(
              body: Center(
                child: CircularProgressIndicator(),
              ),
            );
          });
    }
  }
  </code></pre>
  <hr />
  <p>The issue happens in this widget:</p>
  <pre><code>import 'package:flutter/material.dart';
  import 'package:provider/provider.dart';
  import 'package:time_tracker_flutter_course/app/home/jobs/jobs_page.dart';
  import 'package:time_tracker_flutter_course/app/sign_in/sign_in_page.dart';
  import 'package:time_tracker_flutter_course/services/auth.dart';
  import 'package:time_tracker_flutter_course/services/database.dart';
  
  class LandingPage extends StatelessWidget {
    @override
    Widget build(BuildContext context) {
      final auth = Provider.of&lt;AuthBase&gt;(context, listen: false);
      return StreamBuilder&lt;User&gt;(
          stream: auth.onAuthStateChanged,
          builder: (context, snapshot) {
            if (snapshot.connectionState == ConnectionState.active) {
              final User user = snapshot.data;
              if (user == null) {
                return SignInPage.create(context);
              }
              return Provider&lt;Database&gt;(
                create: (_) =&gt; FirestoreDatabase(uid: user.uid),
                child: JobsPage(),
              );
            } else {
              return Scaffold(
                body: Center(
                  child: CircularProgressIndicator(),
                ),
              );
            }
          });
    }
  }
  </code></pre>