single

fun <T : Any> single(key: CanvasKey<T>, ctor: suspend CanvasFactory.() -> T)(source)

Registers a singleton dependency in the canvas.

Parameters

key

The CanvasKey associated with your dependency

ctor

Constructor function that creates the dependency instance

Type Parameters

T

The type of the dependency


inline fun <T : Any> single(qualifier: String? = null, noinline ctor: suspend CanvasFactory.() -> T)(source)

Registers a singleton dependency in the canvas.

Parameters

qualifier

Optional qualifier to distinguish between multiple instances of the same type

ctor

Constructor function that creates the dependency instance

Type Parameters

T

The type of the dependency