How to prevent switch component to turn off upon switching screen?

I have this issue everytime I switched screen or navigate to other screen the switch component turns off by itself.

1.) How could I possibly maintain the current status of the switch once you navigate to other screen. Let’s say you left it ON then once you navigate to other screen and go back at it again the current state ON will still remain.


Use tinyDB to save switch status

Try something like this, if you want to initialize on first run as on simple change value if tag not there to true