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.
2
Answers
The ‘name’ is already in a string, you don’t need to use toString() Try removing that.
You have to add
await
toFuture
to get the returned value.