I am trying to retrieve a UID from Firebase and return it to a variable. However I am unable to get it working. Could someone please help on this. Thanks
getUID() async {
final userId = await widget.auth.getCurrentUser();
print('checking user id ${userId.uid}');
return userId.uid;
}
@override
void initState() {
super.initState();
void foo() async {
final userID = await getUID();
print("UID is ${userID}");
}
foo();
print("UID is ${userID}");
}