Closed mahramane closed 1 week ago
Hi, I don't think it's better, I chose Multiplatform Settings on purpose.
One of the Compose Multiplatform targets is wasmjs
and DataStore
does not support it. Using it would make the library not compatible with Compose Web and I wanted to avoid that.
Multiplatform Settings is a very nice abstraction over data storing layer and allows to use DataStore if you need it (docs). Then DataStoreSettings
can be used by compose-remember-setting
:
@Composable
val dataStore: DataStore // = ...
val settings: ObservableSettings = DataStoreSettings(dataStore)
fun WithSettings(content: @Composable () -> Unit) {
CompositionLocalProvider(
LocalComposeRememberSettingConfig provides ComposeRememberSettingConfig(
observableSettings = settings
),
content = content
)
}
Hi I think datastore-preferences is better than multiplatform-settings. and in config you only get
preferences: DataStore<Preferences>
and save data on it. check out https://developer.android.com/topic/libraries/architecture/datastore. it support android, ios, jvm