russhwolf / multiplatform-settings

A Kotlin Multiplatform library for saving simple key-value data
Apache License 2.0
1.7k stars 67 forks source link

How to use SettingsListener? #42

Closed indrih17 closed 4 years ago

indrih17 commented 4 years ago

I created simple observe method, but the callback in the listener is never called.

fun observe(name: String): Flow<Boolean> = callbackFlow {
    offer(get(name))
    val listener = addListener(name) {
        offer(get(name))
    }
    awaitClose {
        listener.deactivate()
    }
}

What am I doing wrong? Library Version 0.5.

indrih17 commented 4 years ago

The problem was in the android studio emulator.