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