Save screen state

Hello everyone,

Can someone give me a hand with saving the state of a screen?
In many apps when you click on an item, it will show another screen with more information and when the back button is pressed the screen hides and goes back to the exact same screen in the exact same state you left it on.

Is this possible with kodular?

Use case:
I will have a list of items, when an item in the list is clicked I want to show more information.

Current setup:
I can imagine this is impacting it. But I am running an API call on screen initialize, so each time the screen comes into view, the data on the screen is reloaded.

Any help would be greatly appreciated.

Thanks!

In this case, I’ll suggest you to use Vertical Arrangements instead of screens, as the data from the API will not be fetched every time the screen is loaded.
Check out the first tip in this topic to learn how to use arrangements as screens :point_down:

2 Likes

There is one other thing you can do.

Setup a tinydb, and when the screen switches, you store all the current variable states in the tinydb, When it switches back, you read the DB to reinitialize.

It can be wonky, because you need to create a session ID, but it does work. I have used it before if I need multiple screens with retained state.

1 Like