Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
CustomComposeNavigator.kt
interface Navigator {
val navActions: StateFlow<NavigationAction?>
fun navigate(navAction: NavigationAction?)
}
class ComposeCustomNavigator : Navigator {
private val _navActions: MutableStateFlow<NavigationAction?> by lazy {
MutableStateFlow(null)
}
override val navActions = _navActions.asStateFlow()
override fun navigate(navAction: NavigationAction?) {
_navActions.update { navAction }
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment