title: Flutter Firestore Stream builder "A value of type 'Stream<DocumentSnapshot<Map<String, dynamic>>>' can't be assigned to a variable"
body: <p>I am trying to retrieve data from my Firestore database via a Streambuilder. The issue I have comes from an error from the following error when I add my doc(uid) into my _usersStream:</p>
  <pre><code>A value of type 'Stream&lt;DocumentSnapshot&lt;Map&lt;String, dynamic&gt;&gt;&gt;' can't be assigned to a variable of type 'Stream&lt;QuerySnapshot&lt;Object?&gt;&gt;'.
  Try changing the type of the variable, or casting the right-hand type to 'Stream&lt;QuerySnapshot&lt;Object?&gt;&gt;'.
  </code></pre>
  <p>I was wondering how to how to rectify this error. Here is my code:</p>
  <pre><code>class _UserProfileScreenState extends State&lt;UserProfileScreen&gt; {
    final Stream&lt;QuerySnapshot&gt; _usersStream = FirebaseFirestore.instance.collection('users').doc(uid).snapshots();
  
    @override
    Widget build(BuildContext context) {
      return StreamBuilder&lt;QuerySnapshot&gt;(
        stream: _usersStream,
        builder: (BuildContext context, AsyncSnapshot&lt;QuerySnapshot&gt; snapshot) {
          if (snapshot.hasError) {
            return Text('Something went wrong');
          }
  
          if (snapshot.connectionState == ConnectionState.waiting) {
            return Text(&quot;&quot;);
          }
  
          return Scaffold(
            appBar: ProfileAppBar(),
            body: ListView(
              children: snapshot.data!.docs.map((DocumentSnapshot document) {
                Map&lt;String, dynamic&gt; data =
                    document.data()! as Map&lt;String, dynamic&gt;;
                return ListTile(
                  title: Text(data['username']),
                  subtitle: Text(data['displayName']),
                );
              }).toList(),
            ),
          );
        },
      );
    }
  }
  
  </code></pre>