RetainStateProvider.NeverRetainExitedValues


An implementation of RetainStateProvider that is not backed by a RetainedValuesStore and is never set to retain exited values. This object is stateless and can be used to orphan a nested RetainedValuesStore and clear any parent-driven state of isRetainingExitedValues.

Summary

Public functions

open Unit

Registers the given observer with this RetainStateProvider to be notified when the value of isRetainingExitedValues changes.

Cmn
open Unit

Removes a previously registered observer.

Cmn

Public properties

open Boolean

Returns whether retained values should continue to be held when they are removed from the composition hierarchy.

Cmn

Public functions

addRetainStateObserver

open fun addRetainStateObserver(
    observer: RetainStateProvider.RetainStateObserver
): Unit

Registers the given observer with this RetainStateProvider to be notified when the value of isRetainingExitedValues changes. The added observer will receive its first notification the next time isRetainingExitedValues is updated.

This method is not thread safe and should only be invoked on the applier thread.

removeRetainStateObserver

open fun removeRetainStateObserver(
    observer: RetainStateProvider.RetainStateObserver
): Unit

Removes a previously registered observer. It will receive no further updates from this RetainStateProvider unless it is registered again in the future. If the observer is not currently registered, this this method does nothing.

This method is not thread safe and should only be invoked on the applier thread.

Public properties

isRetainingExitedValues

open val isRetainingExitedValuesBoolean

Returns whether retained values should continue to be held when they are removed from the composition hierarchy. This indicates that content is being destroyed transiently and that the associated retention scenario of this RetainStateProvider (e.g. navigation moving a screen to the back stack, activity recreation, hidden UI, etc.) is currently active.

When true, associated RetainedValuesStores should continue to retain objects as they are removed from the composition hierarchy for future reuse.