asLiveData
fun <V> SharedPreferencesProperty<V>.asLiveData(): ReadOnlyProperty<ISharedPreferencesOwner, MutableLiveData<V>>
Convert SharedPreferencesProperty to MutableLiveData.
object ThemeSp: ISharedPreferencesOwner {
.... // Code
val theme by boolean(false).asLiveData()
}
// In Activity
val darkTheme by ThemeSp.theme.observeAsState()
Content copied to clipboard
Since
0.5.6