Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
// somewhere at the top, create & remember instance of SaveableStateHolder
val saveableStateHolder = rememberSaveableStateHolder()
// called for every destination with a unique key in navigation structure
// (when created or active)
saveableStateHolder.SaveableStateProvider(key = ...) {
// composable content whose rememberSaveable values will be saved with
// the given key
// remove the saved state, happens during backward navigation i.e destination
// is removed from the backstack.
saveableStateHolder.removeState(key = ...)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment