Navigator

interface Navigator

A navigation component that allows navigation between destinations.

Use Hilt injection to get an instance of this interface.

See also

Inheritors

Functions

Link copied to clipboard
abstract fun currentDestination(): StateFlow<DestinationId<*, *>?>

Current destination as flow.

Link copied to clipboard
abstract fun isInHierarchy(destination: DestinationId<*, *>): StateFlow<Boolean>

Checks whether the given destination is in the back stack.

Link copied to clipboard
open fun navigateTo(to: DestinationId<Unit, *>, navOptions: NavOptions? = null)
open fun navigateTo(to: DestinationId<Unit, *>, builder: NavOptionsBuilder.() -> Unit)

Requests navigation to the given destination which takes no input parameter.

abstract fun <A> navigateTo(to: DestinationId<A, *>, args: A, navOptions: NavOptions? = null)
open fun <A> navigateTo(to: DestinationId<A, *>, args: A, builder: NavOptionsBuilder.() -> Unit)

Requests navigation to the given destination. An required parameter must be passed.

Link copied to clipboard
abstract fun navigateUp()

Navigates up to previous destination, or finishes the Activity.

Link copied to clipboard
abstract fun <R> navigateUpWithResult(from: DestinationId<*, R>, result: R)

Navigates up to previous destination passing the given result, or finishes the Activity.

Link copied to clipboard
abstract fun open(link: Uri)

Opens the given link in a browser.

Link copied to clipboard
abstract fun <R> resultFrom(from: DestinationId<*, R>): Flow<NavigationResult<R>>

Creates a flow that will emit the results of the navigation from the given destination.