subscribe

abstract fun subscribe(action: (value: T) -> Unit)

Registers a function that will be called with the new value whenever the value of this Provider changes. If multiple threads update the value concurrently, intermediate subscriber invocations may be skipped and values may be out of order. If resolving the value of this Provider throws an exception, subscriber invocations will be skipped silently.

Registering a subscriber disables lazy evaluation of the provider.

The given value is not guaranteed to still be the current value at the time of invocation.