【发布时间】:2021-03-15 16:31:13
【问题描述】:
当我尝试更新文档时,我的应用程序不断崩溃。我做错了什么?
Future<bool> updateEvent(data, id) async {
try {
final _ref = _db.collection('content').doc(id);
print(_ref);
await _ref.update(data);
return true;
} catch (error) {
print(error);
return false;
}
}
print(_ref) 返回
flutter: DocumentReference(content/KwaKlb1GpUbqSQd8K9rd)
data是这样设置的
final data = {
"active": true,
"title": _titleTextController.text != null
? _titleTextController.text
: null,
...
};
【问题讨论】:
-
如果您可以打印错误并更新有问题的错误,那将非常有帮助
-
我没有收到任何错误。这就是奇怪的地方。它只是说失去与设备的连接。
-
进入logcat..在那里你可以找到错误。即使在应用崩溃后
-
我不确定如何检查。但这会有所帮助。我将在线检查如何查看logcat。谢谢!我正在使用 iPhone 模拟器
标签: flutter google-cloud-firestore