When i try to check whether a particular number exists in firebase collection or not I always get a null in return. What is the reason for that?
How can I overcome this issue so that the function _numberCheck()
returns a Boolean value which I can use for further processing?
The code for the registration page is as follows:
Future<bool> _numberCheck(mobileno) async {
print("Start of the function");
db
.collection("transcriber_user_registeration")
.getDocuments()
.then((QuerySnapshot snapshot) {
snapshot.documents.forEach((f) async {
isPresent = true;
isPresent = false;
if ('${f.data['userid']}' == mobileno) {
setState(() {
isPresent = true;
});
} else {
setState(() {
isPresent = false;
});
}
});
});
// print(isPresent);
return isPresent;
}