Components: Cloud Variable / DIY Extended Listviewer / Recursive Functions / Dynamic Labels / RealtimeDB Authentication
Hey Thunkers!I have wanting to use firebase for a while to store and retrieve lists of variables. quickly. but parsing all the text is resource consuming, takes a bunch of blocks, and is tricky. I considered the cloud vairables for some time now but couldn’t wrap my head around how to use private user keys. I have figured it out and want to share with everyone here.
In my example, you switch between keys within the single cloud variable. to showcase this use, i have two lists of numbers held in 2 different keys of the same cloud variable. each button will count in 1 position of either key. it works for my purposes. I hope it helps you!
in my main project, I could see using this method to store data in the cloud for the purpose of allowing parents or classroom staff to track the same data at the same time for the same student/child across devices. I think this swill allow me to accomplish that task! I would insert the uuserID from Firebase with a ‘/’ and into the key
screen - cloud counting (inside navigator)
first, I initialize the lists within the cloud variable
next, I set up a listener to wait for changes and make them as needed. notice the logic I used. this will be to keep unnecessary updates occurring to the UI. if you don’t need to set the text, don’t do it. there will be no changes, but the code doesn’t know that so it will ‘redraw’ the same stuff. to the user, there will be no change besides unnecessary slowdowns.
last i have my counter. study it and you will understand! in the block editor thiese are connected, with the top picture being the blocks on the left, bottom are connected to the right side of the top.