provideNavController
Associates a NavHostController with this GleamNavigator, enabling navigation using Gleam composables.
This function adds the navigator to the navigatorProvider
of the provided navController`, making it available for navigation within Gleam screens.
Important: Ensure that the navController
you pass is the same instance used to manage navigation in your application.
Example:
val navController = rememberNavController()
val navigator = rememberGleamNavigator()
navigator.provideNavController(navController)
@Composable
fun MyGleamScreen(navigator: GleamNavigator) {
Button(onClick = { navigator.navigate("SecondScreen") }) {
Text("Go to Second Screen")
}
}
Content copied to clipboard
Return
The same GleamNavigator instance with the added NavHostController.
Parameters
navController
The NavHostController instance responsible for navigation operations.