【发布时间】:2019-10-17 09:45:30
【问题描述】:
我编写了一个简单的云函数,它返回一个保存在我的 Cloud Firestore 数据库中的 id。
云函数如下所示:
exports.getWinkert = functions.https.onCall((data, context) => {
return admin.firestore().collection('users').doc('hash').get()
.then(snapshot => {
const winkertId = snapshot.wwinkert
return { id: winkertId };
})
})
这个函数是从我的颤振应用程序中调用的,代码如下:
Future _getValues() async {
final HttpsCallable callable = CloudFunctions.instance.getHttpsCallable(
functionName: "getWinkert",
);
dynamic resp = await callable.call(<String, dynamic>{
"name": "wwinkert",
});
print(resp.toString());
}
调用该函数后,我得到以下结果:
I/flutter ( 8253): Instance of 'HttpsCallableResult'
问题:如何从 Dart 中的 HttpsCallableResult 实例中获取我的数据?
提前感谢您的帮助!
您好, 劳尔
【问题讨论】:
标签: firebase flutter google-cloud-functions