title: How to modify Flutter Firebase Stream listener based on Firebase Auth stream when using Provider for DI?
body: <p>In my Flutter Firebase App with Provider for state management, I have a stream for reacting to <code>FirebaseAuth.instance.authStateChanges()</code> and a separate stream for listening to the my app related metadata for the logged in <code>uid</code> provided by <code>FirebaseAuth</code>.</p>
  <pre><code>    return MultiProvider(
        providers: [
  
          // This returns a stream of firebase user auth events so my app can react to 
          // login, force logout, etc. 
          StreamProvider&lt;fireauth.User&gt;.value(
            value: FirebaseAuth.instance.authStateChanges(),
          ),
          
          // conditional on non-null FirebaseAuth User, I would like to register a Firestore listener 
          // for the provided userId.
          // For security purposes, if the authenticated uid changes, the listener should be dereigstered.
          // After logout, if a different user is logged in, the this stream should listen to that uid's doc.
          StreamProvider&lt;MyUser&gt;.value(
            value: FirebaseFirestore.instance.collection('users')
                     .doc(/* use the userId from firebaseAuth here! */)
                     .snapshots()
                     .map((ds) =&gt; MyUser.fromJson(ds.data()))
          ),
  
        ],
    );
  </code></pre>
  <p>I think I can use <code>ProxyProvider</code> to allow the <code>MyUser</code> stream to take a dependency on the <code>FirebaseAuth.User</code> stream, but once the <code>MyUser</code> stream is registered for this <code>uid</code>, it seems to be immutable. How can I &quot;reload&quot; the Firestore stream based on the result from the <code>FirebaseAuth.User</code>?</p>