invisible views won’t show up in the display. and normal layouts will skip over them. constraint layout need to explicitly handle them like you’re doing though. one alternative is to setup a new constraint layout that doesn’t include the hidden view if the layout changes a lot when hiding it.
this is by design by the way. because views can also be taken out of the parent at any time and the constraint layout (unlike other layouts) layout continues to refer to them b/c of the lambda. it knows this happens though, and treats the views as readonly from then on. but the lambda has to adjust if you’d like to stop taking those views into account.
one thing to consider is if your use case is better served with a procedural layout or if you really need a constraint based one for this specific case.