【发布时间】:2021-07-05 22:25:15
【问题描述】:
我有一个名为 parent 的集合包含一个名为 class 的属性,我想为我在代码中指定的文档返回此属性的值,
我设法打印了该值,但我无法返回该值以在之后的比较中使用它。
getSpecie(idetud) async {
DocumentReference documentReference = parsref.doc(idetud);
int specie = 0;
await documentReference.get().then((snapshot) {
specie = snapshot["classe"];
print(
"======================================================================== field value");
print(specie); // this works good
});
return specie; // but this no !!!!
}
【问题讨论】:
标签: firebase flutter google-cloud-firestore