put

fun <T : Any> ServiceLocator.put(key: LifecycleKey<T>, minimumState: Lifecycle.State = Lifecycle.State.STARTED, threadSafetyMode: LazyThreadSafetyMode = defaultLazyKeyThreadSafetyMode, provider: () -> T)

Registers a lifecycle-aware service provider for the given key.

Parameters

key

The LifecycleKey to associate with the provider.

minimumState

The lowest state the LifecycleOwner should be in for the service to be retained. Defaults to Lifecycle.State.STARTED.

threadSafetyMode

The thread safety mode for the lazy initialization.

provider

A lambda that creates the service instance.