Skip to content

Document LocalAmbientState.current #2628

@ithinkihaveacat

Description

@ithinkihaveacat

The AmbientAware composable makes the ambient state available via two mechanisms:

  • Via an AmbientState passed to AmbientAware's block argument. This is documented.
  • Via the LocalAmbientState.current CompositionLocal (source). This mechanism does not appear to be documented.

Is there a reason for not calling this out? e.g. it's not recommended practice?

I'm not really sure what the convention is, although it does seem to satisfy the requirements/guidelines of the pattern. (It's cross-cutting, and intermediate layers should not be aware it exists. Also somewhat annoying to have to plumb through.)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions