why is the variable showing undefined? i clearly declared it above. any help is highly appreciated...i even tried declaring the variable as string, still didn't work
createUser() async {
//Todo: check if user exists in database
GoogleSignInAccount user = googleSignIn.currentUser;
final doc = await usersRef.doc(user.id).get();
//Todo: if user don't exist then take them to set profile page
if (!doc.exists) {
final username = await Navigator.push(
context, MaterialPageRoute(builder: (context) => CreateAccount()));
}
//Todo: get user name from create account and create a new user
usersRef.doc(user.id).set({
"id": user.id,
"userName": username,
"photourl": user.photoUrl,
"displayName": user.displayName,
"timeStamp": timestamp,
});
}
