GuardResult

sealed class GuardResult(source)

The decision returned by a navigation guard or access check.

Guards return a GuardResult to indicate whether navigation should proceed, be rejected, or be redirected to another route.

Example:

val requireAuth: NavigationGuard = { store ->
if (store.selectState<AuthState>().value.isAuthenticated) GuardResult.Allow
else GuardResult.RedirectTo(LoginScreen)
}

Inheritors

Types

Link copied to clipboard

Allow the navigation to proceed normally.

Link copied to clipboard
data class PendAndRedirectTo(val route: String, val metadata: Map<String, String> = emptyMap(), val displayHint: String? = null) : GuardResult

Store the original navigation as a PendingNavigation in state, then redirect.

Link copied to clipboard
data class RedirectTo(val route: String) : GuardResult

Redirect to another route without storing the original destination.

Link copied to clipboard

Silently drop the navigation without any redirect or state change.