whenTrue method

void whenTrue(
  1. void action()
)

Executes action if this boolean is true.

Example: true.whenTrue(() => print('true')) -> 'true'.

Implementation

void whenTrue(void Function() action) {
  if (this) action();
}