I'm trying to get the key of a child that I've already returned from the database. In the example below, I have the user selected as Carlos Sainz and I'm trying to get "csainz" however the code below returns "email".
DatabaseReference keyRef = FirebaseDatabase.instance.reference();
await keyRef.child('users')
.child('email')
.equalTo(userList[0].email) // userList[0].email returns Carlos' email
.once()
.then((DataSnapshot dataSnapshot) {
String newKey = dataSnapshot.key;
print(newKey);
});
