LithoSaveableStateScope

A lifecycle-backed namespace for state declared with useSaveableState.

Obtain a scope with lithoSaveableStateScope and supply it to a root ComponentTree with ComponentTree.Builder.withSaveableStateScope. Use a different key for each independently saved tree owned by the same Fragment or Activity. A scope may be reused by a replacement tree only after the previous tree is released; it must not back multiple live root trees concurrently. Release every tree using this scope before calling close. Closing permanently discards the scope's state, so creating another scope with the same key starts with fresh state.

Functions

Link copied to clipboard
open override fun close()

Unregisters this scope and permanently clears its state after its tree has been released.