title: StreamProvider listening to User doesn't update when User changes
body: <p>In my app, I listen to changes from a User Document in Cloud Firestore.
  I do this by getting the current user ID, and then getting the document associated with that ID.</p>
  <pre><code>class UserService {
    ...
  
    //GET A USER'S INFORMATION AS A STREAM
    // ? IF NO UID IS PASSED, IT GETS THE INFO OF THE CURRENT USER
  
    Stream&lt;User&gt; getUserInfoAsStream({String uid}) async* {
      if (uid == null) {
        uid = await AuthService().getUID();
      }
  
      yield* Firestore.instance
          .collection('users')
          .document(uid)
          .snapshots()
          .map((doc) =&gt; User.fromFirestore(doc));
    }
  
    ...
  </code></pre>
  <p>I then use a <code>StreamProvider</code> to listen to the stream in my <code>main.dart</code></p>
  <pre><code>class MyApp extends StatelessWidget {
    @override
    Widget build(BuildContext context) {
      return MultiProvider(
        providers: [
          StreamProvider&lt;User&gt;.value(
            value: UserService().getUserInfoAsStream(),
          ),
        ],
        child: MaterialApp(
          debugShowCheckedModeBanner: false,
          home: SplashScreen(),
        ),
      ); 
    }
  }
  </code></pre>
  <p>During the course of the app's lifecycle, it works perfectly, but when the user signs out using <code>FirebaseAuth.instance.signOut();</code> and then logs in with a different user, the stream remains constant (<em>i.e it listens to the old <strong>uid stream</strong></em>), and the StreamProvider doesn't listen to the new stream of data.</p>
  <p>| <strong>Sign Out Code For Reference</strong> |</p>
  <pre><code>// ? SIGN OUT CODE: If user signed out, it returns true, else, false
    Future&lt;bool&gt; signOut() async {
      try {
        await _firebaseAuth.signOut();
        return true;
      } catch (error) {
        print(error);
        return false;
      }
    }
  </code></pre>
  <p>| <strong>Where it is used</strong> |</p>
  <pre><code>FlatButton(
     onPressed: () {
       AuthService().signOut().then((value) =&gt;
         Navigator.of(context).pushAndRemoveUntil(
             CupertinoPageRoute(
                builder: (BuildContext context) {
                     return Onboarding();
               }), (route) =&gt; false));
            },
       child: Text(&quot;Yes&quot;)),
  </code></pre>
  <p>To solve the problem, I would've passed the current uid to the StreamProvider instead, but I can only get the current uid asynchronously.</p>
  <p>How can I listen to an asynchronous stream using the StreamProvider, and update it when the user changes?</p>
  <p>EDIT: I managed to fix the problem to some extent by moving the provider up the widget tree to the screen immediately after the login page. But because providers are scoped, I had to create a completely new MaterialApp after my original MaterialApp which is messing up my some components in my app.</p>
  <p>Is there any better workaround?</p>