Can't make a switch remember its previous position by saving and initializing it with TinyDB

Hello folks
I have tried to save whether a switch is off/on, in a TinyDB, and then initialize the data, make it a variable, and make the status of its on value to whatever is saved in the TinyDB, but for some reason, it starts off with being on = false, as if something goes wrong in the process. I would truly appreciate any help I could get.

Look away from the last block with (when Switch_Screen.Click), that was only to switch between two screens to see if switch on boolean had switched.


Why both are same?

1 Like

Thanks, that's the case in this example. It's an example of a larger app where I'm facing the same issue, but it apparently isn't apparent in this app. Thanks for pointing out that I accidentally have put both of them to false.

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.