combineToRoot

open fun combineToRoot(vararg block: ModuleDefinition)

Dynamically registers and combines additional dependency definitions into the root scope.

  • This is primarily used during the application's startup phase to bootstrap the initial dependency graph. By providing ModuleDefinitions, you can define how various services and managers should be instantiated at the topmost level of the hierarchy.

Usage Example:

class MyTargetApplication : Application(), RootComponent {
override val scope = ScopeImpl(...)

override fun onCreate() {
super.onCreate()
combineToRoot(networkModule, databaseModule)
}
}

Parameters

block

A variable number of ModuleDefinitions to be integrated into the root scope.

See also