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> paint(qualifier: String? = null): T

Creates a dependency instance using reified type parameters.

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

Creates a dependency instance during the canvas building phase. Local bindings are resolved first. If this canvas does not contain key, lookup falls back through the parent canvas. Construction is eager, so parent-owned instances are reused and child overrides do not rewire services already created by the parent.