since your question is not enough clear but.. if you mean to get the current id user to get it's the specific id you marked so you must first get the current id from the Auth
you use for users..
you didn't mentioned what the kind auth you use but lets see you use email/password Auth
this is for getting the currentUser
late User currentUser;
currentUser = User.fromDocument(doc.data());
and of course you need to make model for getting the data you mentioned like so
Note to add your own data that you mentioned in picture.. i am here use only one data that get for example the uid
class User {
String? uid;
User({
this.uid,
});
factory User.fromDocument( doc ) {
return User(
uid: doc["uid"],
);
}
}
now everything are stored into currentUser.// lastname or Street
in your FutureBuilder Widget you can use something like this
FutureBuilder<QuerySnapshot>(
future: FirebaseFirestore.instance.collection("AddDeliverAddress").doc(currentUser.uid).get(),
builder: (BuildContext context, AsyncSnapshot<QuerySnapshot> snapshot) {
if (!snapshot.hasData) {
return const Expanded(child: SizedBox()) ;
}
return Text(currentUser.street);
}
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.