问题
I am not very familiar with using dart and firebase and I was wondering how I could get all the children of a certain node and how I could check if a node exists
回答1:
Something like this should you get the list of users:
static Future<int> getUserAmount() async {
final response = await FirebaseDatabase.instance
.reference()
.child("Users")
.once();
var users = [];
reponse.value.forEach((v) => users.add(v));
print(users);
return users.length;
}
You can check with users
what you need to check and then return a result;
来源:https://stackoverflow.com/questions/49799171/flutter-firebase-how-do-i-get-all-the-children-of-a-node