canvas
Creates a new Canvas using the canvas DSL.
This is the primary way to create a canvas with dependency bindings. The canvas supports hierarchical dependency resolution and automatic lifecycle management.
Return
A fully initialized Canvas
val canvas = canvas {
single<UserService> { UserServiceImpl() }
single<DatabaseConfig> { loadConfig() }
}Content copied to clipboard
Parameters
parent
Optional parent canvas for fallback dependency resolution
build
DSL block for configuring dependency bindings