Issue
I've seen this question answered multiple times already for JavaScript and other languages. There, it always comes down to get a snapshot and use a method called exists()
to check. But in Dart/Flutter, there is no such method. Here's what I have for now:
devicesRef.child(deviceId).once().then((DataSnapshot data) {
print(data.key);
print(data.value);
});
I want to check whether a node called deviceId
already exists.
So how can I check if a node exists in Firebase Realtime Database with Dart/Flutter?
Solution
I would guess, since there is no such thing as a null child value in Realtime Database, that you could simply check if data.value
is null.
Answered By - Doug Stevenson
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.