'How to get the data from realtime firebase and use it to login
I want to get that data and compare it in the text box for my login
Solution 1:[1]
try this way
onTap: () async {
final QuerySnapshot result = await FirebaseFirestore
.instance
.collection(usernameController.text)
.get();
final List<DocumentSnapshot> documents = result.docs;
try {
DocumentSnapshot kjnk = documents[1];
print(kjnk.id);
print(kjnk[kjnk.id]);
if (kjnk[kjnk.id] == passwordController.text) {
util.showToast("Success");
Navigator.pushNamed(context, "/second");
} else {
util.showToast(
"Please Enter the correct Password");
Navigator.pop(context);
}
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 |
