Hello, this may be a noob question but i need to s...
# compose-android
m
Hello, this may be a noob question but i need to somehow store a mutableState variable in the storage so that on app restart the value won't be reset. I need this to implement theme selection behavior The below picture my code I want the themeSelectedOption variable to be stored but i don't know how Thanks for reading
s
You'll need to decide where this information will be stored. Datastore is a nice option, which will return flows of that data, which you can collectAsState to use in your composables. NiA is using Datastore afaik to store exactly the user choice for theme options, might wanna take a look at that https://github.com/android/nowinandroid
ł
s
With SharedPreferences you'll likely be doing file I/O on the main thread without realizing. DataStore is convenient enough that I don't really see the reason to use SharedPrefs tbh
m
Thanks will check it out