BoolExtensions extension

Extension for boolean (bool) values to provide utility methods for common operations like toggling, conditionally executing actions, and converting to different string representations.

on

Properties

toggled bool

Available on bool, provided by the BoolExtensions extension

Returns the opposite of the boolean value.
no setter

Methods

ifElse<T>(T onTrue(), T onFalse()) → T

Available on bool, provided by the BoolExtensions extension

Executes the onTrue function if the boolean is true, otherwise executes the onFalse function.
toActiveInactive() String

Available on bool, provided by the BoolExtensions extension

Returns 'Active' if true, 'Inactive' if false.
toCheckedUnchecked() String

Available on bool, provided by the BoolExtensions extension

Returns 'Checked' if true, 'Unchecked' if false.
toCustomText(String trueText, String falseText) String

Available on bool, provided by the BoolExtensions extension

Returns trueText if true, falseText if false.
toEnabledDisabled() String

Available on bool, provided by the BoolExtensions extension

Converts the boolean to a string representation: 'Enabled' for true, 'Disabled' for false.
toInt() int

Available on bool, provided by the BoolExtensions extension

Converts the boolean to an integer: 1 if true, 0 if false.
toOnOff() String

Available on bool, provided by the BoolExtensions extension

Converts the boolean to a string representation: 'On' for true, 'Off' for false.
toVisibility() String

Available on bool, provided by the BoolExtensions extension

Returns 'Visible' if true, 'Hidden' if false.
toYesNo() String

Available on bool, provided by the BoolExtensions extension

Converts the boolean to a string representation: 'Yes' for true, 'No' for false.
whenFalse(void action()) → void

Available on bool, provided by the BoolExtensions extension

Executes the action only if the boolean is false.
whenTrue(void action()) → void

Available on bool, provided by the BoolExtensions extension

Executes the action only if the boolean is true.