English 中文(简体)
kotlin multiplatform how to use navHostController for Android
原标题:

I am learning KMM and come across an issue on how to use local function variable for expect/actual functions. Using expect and actual function I would like to do something with compose navigation in Android like below:

commonMain

expect fun navigateToSignInEmail()

androidMain

actual fun navigateToSignInEmail() {
  navHostController.navigate("ViewSignInEmail")
}

However, since navHostController cannot be declared on global and had to pass around using function, is there a way I can use it as above to provide navigation function? I do not want to pass the whole navHostController as my iOS app would be using something different for navigation.

Thanks for help!

问题回答

暂无回答




相关问题
Exposed runs query on all HikariCP open connections

I m running a Ktor server with a PostgreSQL database and just set up the JetBrains Exposed ORM framework with HikariCP for connection pooling (per the recommendation in the Ktor documentation). My ...

SQLite Kotlin issue - no database

I am trying to create boardgamegeek APIs based app in AndroidStudio, however from unknown reason I m getting my database created with no columns. Here s Logical log: (1) no such table: games in "...

Flutter App cannot be installed on Android TV

I m building a Flutter app that should support Android TV and Mobile devices. Despite Google Play shows that it is supported, I cannot install app on my MiBox device. While trying to install it, both ...

热门标签