I want the username from the current logged in user in my flutter app.
This is what I have currently.
Future<String> get username async {
await FirebaseFirestore.instance
.collection('users')
.doc(user.uid)
.get()
.then((snapshot) {
if (snapshot.exists) {
return snapshot.data()!['username'].toString();
}
});
return 'No User';
}
It's giving me "Instance of 'Future<String>'.