navigation

inline fun <T : Any> ScopeDSL.navigation(noinline definition: @Composable Scope.(T) -> Unit): KoinDefinition<EntryProviderInstaller>

Declares a scoped navigation entry within a Koin scope DSL.

This function registers a composable navigation destination that is scoped to a specific Koin scope, allowing access to scoped dependencies within the composable. The route type T is used as both the navigation destination identifier and a qualifier for the entry provider.

Example usage:

activityScope {
viewModel { MyViewModel() }
navigation<MyRoute> { route ->
MyScreen(viewModel = koinViewModel())
}
}

Return

A KoinDefinition for the created EntryProviderInstaller

Parameters

T

The type representing the navigation route/destination

definition

A composable function that receives the Scope and route instance T to render the destination

See also

for module-level navigation entries


inline fun <T : Any> Module.navigation(noinline definition: @Composable Scope.(T) -> Unit): KoinDefinition<EntryProviderInstaller>

Declares a singleton navigation entry within a Koin module.

This function registers a composable navigation destination as a singleton in the Koin module, allowing access to module-level dependencies within the composable. The route type T is used as both the navigation destination identifier and a qualifier for the entry provider.

Example usage:

module {
viewModel { MyViewModel() }
navigation<HomeRoute> { route ->
HomeScreen(myViewModel = koinViewModel())
}
}

Return

A KoinDefinition for the created EntryProviderInstaller

Parameters

T

The type representing the navigation route/destination

definition

A composable function that receives the Scope and route instance T to render the destination

See also

for scope-level navigation entries