compute

open fun compute(predicate: () -> Boolean, ifTrue: ComponentBuilder.() -> Unit, ifFalse: ComponentBuilder.() -> Unit): ComponentBuilder

Conditionally applies one of two consumer lambdas to this component builder based on a predicate result. Evaluates the predicate function and applies the ifTrue consumer if the result is true, or the ifFalse consumer if the result is false.

Return

this component builder for chaining

Parameters

predicate

the function that returns a boolean to determine which consumer to apply

ifTrue

the consumer lambda that operates on a component builder, executed when predicate returns true

ifFalse

the consumer lambda that operates on a component builder, executed when predicate returns false