I am having the same problem as the poster in this question: flutter validate form asynchronously.
However, I'm having trouble implementing this and understand how the validation is working.
First, what does this code return? Does this return a boolean?
Future checkUser() async {
var user = await Firestore.instance
.collection('users')
.document(userNameController.text)
.get();
return user.exists;
Second, what is the userNameValidator in this case? Is this a boolean?
new TextFormField(
validator: (value) {
return usernameValidator;
},
Thanks, for the help.
checkUser()returnsFuture<bool>