简体   繁体   English

如何在 flutter 中显示来自 Firestore 的特定文档详细信息

[英]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.我正在尝试针对当前登录的用户从 firestore 获取单个文档。 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:正如cloud firestore docs中所写,这是获取单个文档的方法:

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.如果您有用户 ID,则可以将其用作文档名称来为每个用户加载特定文档。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 Flutter / FireStore:如何在Flutter中显示Firestore中的图像? - Flutter / FireStore: how to display an image from Firestore in Flutter? 如何使用 Android 在 RecyclerView 中显示来自 Firestore 的文档及其子集合? - How to display a document with its subcollections from Firestore in a RecyclerView with Android? 当我单击 listView 项目时,如何在另一个活动中显示来自 firestore 的详细信息? - How to display detail informations from firestore in another activity when I click a listView item? 如何读取文档 firestore -flutter 中的数据引用 - How to read data reference in a document firestore -flutter 颤振:文档firestore api - Flutter : document firestore api 如何使用 flutter 从 Firestore 中的特定文档中检索字段值? - How can i retrieve a field value from a specific document in firestore using flutter? 如何在 Flutter 中使用 FutureBuilder 显示来自 firestore 数据库的当前用户数据? - How to display the current user data from firestore database using FutureBuilder in Flutter? Flutter Firebase:如何从 Firebase 调用显示名称和 UID 验证然后使用这些值并保存在 Cloud Firestore - Flutter Firebase : How to call Display Name and UID from Firebase Auth then use those values and save in Cloud Firestore Firestore-如何从文档中知道ID? - Firestore - How to know the id from a document? 如何从 Firestore 中删除选定的文档 ID - How to delete selected document ID from Firestore
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM