Im new to flutter and firestore. I´m building a social media app and need to get some userinformation from the current logged in user to the user profilepage. Surch as username, email etc. I have manage to get the userdata up to firestore, but Im struggling to get the current userinformation back to my project.
I've tryed this method, and it does get the userinformation back from firestore, but not the current userinformation unfortuinetly. I guess the plroblem is that Im stuck on the first document in my database on firestore?
StreamBuilder(
stream:
Firestore.instance.collection('userData').snapshots(),
builder: (context, snapshot) {
if (!snapshot.hasData) {
return CircularProgressIndicator();
}
return Container(
child: Padding(
padding: const EdgeInsets.only(top: 75.0),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
Text(
snapshot.data.documents[0]['userName'],
style: TextStyle(fontSize: 25.0),
),
Padding(
padding: const EdgeInsets.only(top: 5.0),
child:
Text(snapshot.data.documents[0]['email']),
),
],
),
),
);
}),
I would really appreciate any potential solutions.
Thank you!