RememberInComposition


RememberInComposition is used by an associated lint check to enforce that a marked constructor, function, or property getter is not called directly within composition. This should be used to mark APIs that:

  • Return stateful / mutable objects that should be reused across compositions

  • Return objects whose identity is important to maintain across compositions, for example lightweight objects used as 'keys' for other APIs

  • Return objects that are expensive to instantiate, and should be remembered for performance reasons

Note that the lint check will recommend that users either remember this call, or move it outside composition. As a result this should not be used to mark APIs that are intended to be used inside a side effect, as these should not be called inside a remember block.

Summary

Public constructors

Cmn

Public constructors

RememberInComposition

RememberInComposition()