I am trying to retrieve data from firestore and put the val in an if statement but when I did It gave me this error :
I/flutter ( 8492): Closure: () => String from Function 'toString':.
Here is my code:
void getUserData() async {
try {
firestoreInstance
.collection('Users')
.document(usernameController.text)
.get()
.then((value) {
setState(() {
email = (value.data)['email'];
password = (value.data)['password'];
gender = (value.data)['gender'];
username = (value.data)['username'];
userType = (value.data)['userType'];
});
});
} catch (e) {
print(e.toString);
}
}
forgot to mention that when I print userType which is a text It Give me NULL.