NavEaseController

class NavEaseController(backStack: NavBackStack<NavKey>, showExitDialog: () -> Unit = {}, defaultTransition: NavTransition = NavTransition.Push)

Orchestrates navigation across the back stack.

One instance is created per io.github.alimsrepo.navease.runtime.presentation.NavEaseNavGraph call and is never shared between independent nav graphs — this prevents back-stack or result cross-contamination in nested / multi-window setups.

Parameters

showExitDialog

Called when back is invoked at the root (back-stack size == 1).

defaultTransition

The app-level fallback transition used when navigate is called without an explicit NavTransition override. Supplied by io.github.alimsrepo.navease.runtime.presentation.NavEaseNavGraph from the navTransition parameter of NavEaseHost.

Constructors

Link copied to clipboard
constructor(backStack: NavBackStack<NavKey>, showExitDialog: () -> Unit = {}, defaultTransition: NavTransition = NavTransition.Push)

Functions

Link copied to clipboard
fun back()

Pops the current screen. If the back stack contains only the root screen, showExitDialog is invoked instead.

Link copied to clipboard

Posts result back to the previous screen and immediately pops the current screen.

Link copied to clipboard

Returns a snapshot of the current back stack, oldest entry first.

Link copied to clipboard
fun navigate(navKey: NavKey, finish: Boolean = false, singleTop: Boolean = false, navTransition: NavTransition? = null)

Pushes navKey onto the back stack.

Link copied to clipboard
fun popToIndex(index: Int)

Pops the back stack down to index (0 = root). All entries above index are removed. Use getHistory to determine the target index before calling this.

Link copied to clipboard
fun popUpTo(key: NavKey, inclusive: Boolean = false)

Pops the back stack until key's screen is reached.

Link copied to clipboard

Inline reified convenience overload of resultOf.

Observes the result of type T returned by a child screen via backWithResult.