CanvasFactory

Factory for creating Canvas instances from dependency bindings.

This class handles the initialization of all registered dependencies and manages their lifecycle, including cleanup of locally owned AutoCloseable instances when the canvas is closed.

Parameters

bindings

Map of dependency keys to their construction state

parent

Optional parent canvas for dependency resolution fallback

Functions

Link copied to clipboard
inline suspend fun <T : Any> source(qualifier: String? = null): T

Resolves a required dependency during construction using reified type parameters.

suspend fun <T : Any> source(key: CanvasKey<T>): T

Resolves a required dependency during eager Canvas construction. Local bindings are resolved first. If this canvas does not contain key, lookup falls back through explicit parent bindings, then the optional CanvasDependencyResolver. Construction is eager, so parent-owned instances are reused and child overrides do not rewire services already created by the parent.