raamcosta / compose-destinations

Annotation processing library for type-safe Jetpack Compose navigation with no boilerplate.
https://composedestinations.rafaelcosta.xyz
Apache License 2.0
3.14k stars 129 forks source link

Can not make dependenciesContainerBuilder example work #628

Closed Yakoot closed 2 months ago

Yakoot commented 2 months ago
            DestinationsNavHost(
                navGraph = NavGraphs.root,
                dependenciesContainerBuilder = {
                    destination(TestScreenDestination) {
                        dependency(scaffoldState)
                    }
                }
            )

my screens

@Destination<RootGraph>(
    start = true,
)
@Composable
fun WelcomeScreen() {
    Text("welcome")
}

@Destination<RootGraph>
@Composable
fun TestScreen(
    scaffoldState: ScaffoldState
) {
    Text("testtest")
}

and I'm getting an error Type mismatch: inferred type is TestScreenDestination but Nothing was expected

image

destinations version 2.0.0-beta01 compose bom version 2024.04.01

Yakoot commented 2 months ago

https://github.com/Yakoot/TestComposeDestinations

raamcosta commented 2 months ago

Just need to import the function, rather than trying to call what's not even the function 😅

this is the import btw, but the IDE will help you as well: import com.ramcosta.composedestinations.navigation.destination