So I've built out a flutter app, but have been struggling to integrate notifications. After a lot of testing, I am like 99.99% to the solution - but just have one thing that is frustrating the heck out of me! I'm using firebase and most of the code is dart, but in my cloud functions index.js file I'm working with JavaScript for the first time.
My database is structured like so
I am able to retrieve the Host value using the code below - however, I can't figure out how to get the event name!! I understand that best practice may be to just not use spaces when creating the fields, but I already have a bunch of data and don't want to go through the entire database/code to switch all of the references. I tried a bunch of things such as putting it in brackets, quotes, using _, -, +, but I just can't figure out how to retrieve it!
I'm sure I'm just being dumb.... is there a super simple solution to retrieve the Event Name using the snapshot?
In JavaScript you can use both dot notation (e.g. object.property) and array notation (e.g. object["property"]) to access properties of an object.
So to get a field with a space in the you can use the latter:
snapshot.data()["Event Name"]