In Firebase you can listen for a single value event, with once()
/addListenerForSingleValueEvent()
/observeSingleEventOfType()
. This adds a temporary listener that will receive a single value event and then unregister it.
But if no value currently exists at the location, this will fire with null
. This is valid behavior. But what if you want to wait for the first value at the location?
The files below show how to do that for the three main languages: Java, JavaScript and Swift.