I have a code like this:
name = FirebaseFirestore.instance.collection("users").doc("${FirebaseAuth.instance.currentUser?.uid}").get().then((value) => value.data()!["name"]).toString();
I get the following output from this code:
Instance of 'Future <dynamic>'
How can I resolve this error?
Thanks for help.
>Solution :
You have to add await to Future to get the returned value.
var snapshot = await FirebaseFirestore.instance.collection("users").doc("${FirebaseAuth.instance.currentUser?.uid}").get();
if(snapshot.data!=null){
name=snapshot.data!['name'];
}
