providerOrNull

open fun <C : Any, T : Any> providerOrNull(key: DI.Key<C, Unit, T>, context: C, overrideLevel: Int = 0): () -> T?

Retrieve a provider for the given key, or null if none is found.

Return

The found provider, or null if no provider was found.

Parameters

C

The key context type.

T

The key return type.

key

The key to look for.

context

The context to pass to the binding.

overrideLevel

0 if looking for the regular binding, 1 or more if looking for a binding that has been overridden.

Throws

When calling the provider function, if the instance construction triggered a dependency loop.