简体   繁体   中英

How to display a specif document detail from firestore in flutter

I am trying to fetch a single document from firestore against the current logged in user. I need that piece of code if anyone can provide it.

As writtenn in the cloud firestore docs this is how you can fetch a single document:

Firestore.instance
        .collection("users")
        .document(userId)
        .get()
        .then((DocumentSnapshot ds) {
      // use ds as a snapshot
    });

If you have the user id you can use it as the document name to load a specific document per user.

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.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM