https://kotlinlang.org logo
#flow
Title
j

Jintin

12/08/2020, 5:53 AM
make a sample project to get sharepreference update on Android via flow (and also liveData and observable) https://github.com/Jintin/PreferencesExtension usage is like:
Copy code
val preferenceLiveData = preference.liveData<String>(MY_KEY)
preferenceLiveData.observe(this) {
    // get update here
}
val observable = preference.observable<String>(MY_KEY)
observable.subscribe {
    // get update here
}
val flow = preference.flow<String>(MY_KEY)
flow.collect {
    // get update here
}
hope you guys will like it. thanks