I used this code in the past in my project and it was work perfectly
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();
});
But now it's Not Accept ".then
"
the Error is "The method 'then' isn't defined for the type 'User"