shouldBeVisible

Determines whether the current navigation state should be visible based on the back stack.

This property uses produceState to collect changes from the backStack StateFlow.

  • It transforms the backStack to emit true if there is at least one entry, indicating the content should be visible.

  • It collects the transformed value and updates the shouldBeVisible state.

This ensures that shouldBeVisible reflects the current navigation state and changes dynamically as the back stack evolves.