# Navigation Operations

Guia provides an extensive list of navigation operations.

### currentKey

```kotlin
val Navigator.currentKey
```

Returns the current `NavigationKey`

### currentEntry

```kotlin
val Navigator.currentEntry
```

Returns the current `BackStackEntry`

### push

```kotlin
fun Navigator.push(
    navigationKey: NavigationKey
)
```

Adds a new key to the backstack.

### pop

```kotlin
fun Navigator.pop(): Boolean
```

Pops the last entry in the backstack.

### replaceLast

```kotlin
fun Navigator.replaceLast(
    navigationKey: NavigationKey
)
```

Adds a new key to the backstack.

### replaceUpTo

```kotlin
fun Navigator.replaceUpTo(
    navigationKey: NavigationKey,
    inclusive: Boolean = true,
    predicate: (NavigationKey) -> Boolean
)
```

Loops through navigation keys from the top of the backstack until the predicate is satisfied and replaces all those keys with a new key.

### replaceUpTo \[Key]

```kotlin
inline fun <reified Key : NavigationKey> Navigator.replaceUpTo(
    navigationKey: NavigationKey,
    inclusive: Boolean = false
)
```

Replaces all navigation keys in the backstack until a key of type \[Key] is reached.

### moveToTop

```kotlin
fun Navigator.moveToTop(
    match: Match = Match.Last,
    predicate: (NavigationKey) -> Boolean
): Boolean
```

Moves a navigation key that matches the given condition to the top

### moveToTop \[Key]

```kotlin
inline fun <reified Key : NavigationKey> Navigator.moveToTop(
    match: Match = Match.Last,
)
```

Moves a navigation key of type \[Key] to the top of backstack.

### singleInstance

```kotlin
inline fun <reified Key : NavigationKey> Navigator.singleInstance(
    navigationKey: Key,
    match: Match = Match.Last,
    checkForExisting: Boolean = false,
)
```

Navigates to a navigation key and removes all navigation keys that are of the same type from the backstack.

### singleTop

```kotlin
inline fun <reified Key : NavigationKey> Navigator.singleTop(
    navigationKey: Key
)
```

Navigates to \[navigationKey] if the [currentKey](#currentkey) is not of the same type.

### popTo

```kotlin
fun Navigator.popTo(
    inclusive: Boolean = false,
    predicate: (NavigationKey) -> Boolean,
)
```

Pops to a \[NavigationKey] matching \[predicate]

### popTo \[Key]

```kotlin
inline fun <reified Key : NavigationKey> Navigator.popTo(
    inclusive: Boolean = false,
    crossinline predicate: (Key) -> Boolean = { true },
)
```

Pops to a \[NavigationKey] of the same type \[Key].

### removeAll

```kotlin
fun Navigator.removeAll(
    predicate: (NavigationKey) -> Boolean
)
```

Removes all navigation keys matching \[predicate].

### removeAll \[Key]

```kotlin
inline fun <reified Key : NavigationKey> Navigator.removeAll()
```

Removes all navigation keys that are of type \[Key].

### popToRoot

```kotlin
fun Navigator.popToRoot()
```

Pops to the root of the backstack.

### setRoot

```kotlin
fun Navigator.setRoot(
    navigationKey: NavigationKey
) 
```

Clears the backstack and sets a new root \[NavigationKey]

### canGoback

```kotlin
fun Navigator.canGoBack(): Boolean
```

Whether or not the navigator has more than one element and can pop back stack.

### none

```kotlin
fun Navigator.none(
    predicate: (NavigationKey) -> Boolean
)
```

Checks if none of the navigation keys matches the condition.

### none \[Key]

```kotlin
inline fun <reified Key : NavigationKey> Navigator.none()
```

Checks if none of the navigation keys is of type \[Key].

### any

```kotlin
fun Navigator.any(
    predicate: (NavigationKey) -> Boolean
)
```

Checks if any of the navigation keys matches the condition.

### any \[Key]

```kotlin
inline fun <reified Key : NavigationKey> Navigator.any()
```

Checks if any of the navigation keys is of type \[Key].


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://roudi.gitbook.io/guia-navigation/using-guia/the-lore/navigator/navigation-operations.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
