'How to store data in Jetpack Compose Desktop?

I am creating an application in Jetpack Compose Desktop which will take user input and after user reopens the application that input value should be there. I mean a user given data should be there after user reopens the application.

remember { mutableStateOf } doesn't work here

I didn't get tag for jetpack compose desktop so I have android Jetpack Compose tag



Solution 1:[1]

The remember will only save data while the current view is visible on the screen. Check out more about state it compose in documentation.

If you need to save something between application runs, you need to save it to a database or write it to a file and read it when the application runs.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Pylyp Dukhov