-
public final class NavHostStateKt
-
-
Method Summary
Modifier and Type Method Description final static <T extends Any> NavHostState<T>rememberNavHostState(NavBackstack<T> backstack)Remembers NavHostState. final static <T extends Any, S extends Any> ScopingNavHostState<T, S>rememberScopingNavHostState(NavBackstack<T> backstack, NavScopeSpec<T, S> scopeSpec)Remembers ScopingNavHostState. -
-
Method Detail
-
rememberNavHostState
@Composable() final static <T extends Any> NavHostState<T> rememberNavHostState(NavBackstack<T> backstack)
Remembers NavHostState. This allows you to hoist the state of NavHost and conditionally remove it from composition without losing saved states and created architecture components (Lifecycle, ViewModelStore, SavedStateRegistry) of every NavHost entry.
If you do want to remove NavHost from composition and clear all its state, use NavHostVisibility or NavHostAnimatedVisibility instead.
- Parameters:
backstack- the backstack from a NavController that will be used to observe navigation changes.
-
rememberScopingNavHostState
@Composable() final static <T extends Any, S extends Any> ScopingNavHostState<T, S> rememberScopingNavHostState(NavBackstack<T> backstack, NavScopeSpec<T, S> scopeSpec)
Remembers ScopingNavHostState. This allows you to hoist the state of ScopingNavHost and conditionally remove it from composition without losing saved states and created architecture components (Lifecycle, ViewModelStore, SavedStateRegistry) of every ScopingNavHost entry.
If you do want to remove ScopingNavHost from composition and clear all its state, use NavHostVisibility or NavHostAnimatedVisibility instead.
- Parameters:
backstack- the backstack from a NavController that will be used to observe navigation changes.scopeSpec- specifies scopes for every destination.
-
-
-
-