[英]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.