get

fun <T : Any> ServiceLocator.get(key: ServiceKey<T, *, Unit, *>): T

Fetches an item for key. If no provider has been registered, this will delegate to ServiceLocator.onMiss.


inline fun <T : Any> ServiceLocator.get(): T

A convenience extension to fetch a singleton instance from the ServiceLocator using its reified type T as the key.

This is equivalent to calling get(classKey<T>()). If no provider has been registered for T, this will delegate to the locator's onMiss behavior.

Receiver

The ServiceLocator to retrieve the service from.

Return

The singleton instance of type T.