BoolExtensions extension

Extensions for bool operations and utilities.

on

Properties

toggled → bool

Available on bool, provided by the BoolExtensions extension

Returns the logical negation of this value.
no setter

Methods

fold<T>(T whenTrue, T whenFalse) → T

Available on bool, provided by the BoolExtensions extension

Returns whenTrue if true, otherwise whenFalse.
ifFalse(void action()) → void

Available on bool, provided by the BoolExtensions extension

Runs action only when the value is false.
ifTrue(void action()) → void

Available on bool, provided by the BoolExtensions extension

Runs action only when the value is true.
toInt() → int

Available on bool, provided by the BoolExtensions extension

Converts the boolean to an integer (true -> 1, false -> 0).
toYesNo({String yes = 'Yes', String no = 'No'}) → String

Available on bool, provided by the BoolExtensions extension

Returns 'Yes' when true and 'No' when false.