[英]How to access a particular field of other document which is in some "abc" Collection from some other "xyz" Collection in Firestore Flutter?
[英]how to obtain a particular document from a collection in firestore using Flutter
我是dart的新手,所以顯然是撲朔迷離的。。。我確實集成了firestore並在android java中進行了編程..因此,我發現要理解在Android java和flutter中與Firestore有關的含義有點困難。
例如,在flutter中,addOnCompleteListener(android java)的替代方案是什么?
關於您如何從集合中獲取文檔的問題,可以參考以下代碼
DocumentReference documentReference =
Firestore.instance.collection("users").document("John");
documentReference.get().then((datasnapshot) {
if (datasnapshot.exists) {
print(datasnapshot.data['email'].toString(););
}
else{
print("No such user");
}
考慮到用戶集合中有一個名為John的文檔,其數據為電子郵件:“ j@gmail.com”。
您會發現文檔非常有用,並且顫振幾乎也具有所有功能。 只是您應該能夠執行錯誤和異常處理。
oncomplete()和listen()函數可能非常有幫助。 希望能有所幫助。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.