useSaveableState
Declares component state that can be restored by a lifecycle-backed host.
The owning registry, component identity, hook call site, and optional key identify the value. The initializer runs when no value has been retained or restored for that identity. Values captured by initializer are initial inputs rather than observable dependencies; use key to represent a different logical state owner.
When this component leaves the committed tree, its provider is removed and its value is not retained by this hook. A lifecycle or navigation host that replaces the whole ComponentTree can retain the tree's registry explicitly so active values survive into the replacement tree.
The saver must encode the value into a type supported by Android android.os.Bundle. The default saver stores Bundle-compatible values directly. The factory and saver may run on a Litho resolve thread and must not access Views or other main-thread-only objects.