【发布时间】:2020-12-12 17:55:44
【问题描述】:
我过去在我的项目中使用过这段代码,它运行良好
FirebaseAuth.instance.currentUser.then((user) {
FirebaseFirestore.instance.collection('todos').doc().set({
'body': theController.text,
'done': false,
'user_id': user.uid,
'time': DateTime.now().toString(),
});
}).then((value) {
Navigator.of(context).pop();
theController.clear();
});
但现在不接受“.then”
错误是“没有为“用户”类型定义方法“然后”
【问题讨论】:
-
检查我链接的所有 3 个重复项,
currentUser现在是一个属性,不会返回 Future