title: Flutter Firestore: Streambuilder returning data from different user documents
body: <p>I am having a small problem of user data being returned from different docs i.e. when signed in user returns profile data of another account. How do I return user specific data to respective accounts?</p>
  <p>My code:</p>
  <pre><code>FirebaseAuth _auth = FirebaseAuth.instance;
  final uid = _auth.currentUser!.uid;
    final Stream&lt;DocumentSnapshot&lt;Map&lt;String, dynamic&gt;&gt;&gt; db = FirebaseFirestore
        .instance
        .collection('users')
        .doc(uid)
        .collection('Profile')
        .doc('Personal details')
        .snapshots();
  
  
  
                       Row(
                        mainAxisAlignment: MainAxisAlignment.spaceBetween,
                        children: [
                          Text('First name'),
                          SizedBox(width: 40),
                          StreamBuilder&lt;DocumentSnapshot&gt;(
                            stream: db,
                            builder: (BuildContext context,
                                AsyncSnapshot&lt;DocumentSnapshot&gt; snapshot) {
                              if (snapshot.hasError)
                                return Text('Something went wrong');
                              if (snapshot.connectionState ==
                                  ConnectionState.waiting)
                                return CircularProgressIndicator();
  
                              dynamic data = snapshot.data!.data();
                              return Text(data['First name']);
                              // return Text('First name', style: boldFont);
                            },
                          ),
                        ]),
                    Divider(color: Colors.black),
                    SizedBox(
                      height: 10,
                    ),
                    Row(
                      mainAxisAlignment: MainAxisAlignment.spaceBetween,
                      children: [
                        Text('Last name'),
                        SizedBox(width: 40),
                        StreamBuilder&lt;DocumentSnapshot&gt;(
                          stream: db,
                          builder: (BuildContext context,
                              AsyncSnapshot&lt;DocumentSnapshot&gt; snapshot) {
                            if (snapshot.hasError)
                              return Text('Something went wrong');
                            if (snapshot.connectionState ==
                                ConnectionState.waiting)
                              return CircularProgressIndicator();
  
                            dynamic data = snapshot.data!.data();
                            return Text(data['Last name'], style: boldFont);
                            // return Text('Last name', style: boldFont);
                          },
                        ),
                      ],
                    ),
  </code></pre>
  <p>For signing out</p>
  <pre><code>onPressed: () async {
                          try {
                            await FirebaseAuth.instance.signOut();
                            errorMessage = '';
                          } on FirebaseAuthException catch (error) {
                            errorMessage = error.message!;
                          }
                          Navigator.of(context).pushReplacementNamed('/signIn');
                          setState(() {});
                        }
  </code></pre>
  <p>Screenshot of db</p>
  <p><a href="https://i.stack.imgur.com/3dfLv.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/3dfLv.png" alt="firestore db" /></a></p>
  <p>Any assistance would be highly appreciated as I've been stuck trying to fix this for two weeks.</p>
  <p>NB: I only have a few months with Flutter, thanks!</p>