[Solved] Why does the code execute without waiting for await to return in dart/flutter?

Taking a closer look at your Firebase function, I was able to identify two issues: Usage of both await and then keywords in the same function. These two statements do the same thing. Quoting this accepted answer. await is just an internal version of .then() (doing basically the same thing). The reason to choose one … Read more

[Solved] Remove value from database using Cloud Functions

You are returning from the function before calling remove. Try: return oldItemsQuery.once(‘value’, function(snapshot) { // create a map with all children that need to be removed var updates = {}; snapshot.forEach(function(child) { updates[child.key] = null }); // execute all updates in one go and return the result to end the function return ref.update(updates); }).then(function() {; … Read more