observe
abstract fun observe( observerCoroutineScope: CoroutineScope, observerActive: StateFlow<Boolean>, key: StateFlow<K?>): ReplicaObserver<T>
Content copied to clipboard
Starts to observe a keyed replica. Returned ReplicaObserver gives access to replica state and error events.
Parameters
observerCoroutineScope
represents life time of an observer. An observer will stop observing when observerCoroutineScope is canceled.
observerActive
a StateFlow of observer states (active or inactive). Allows replica to know if it has active observers. key a StateFlow of keys. When key is changed an observer retargets to another chunk of data.