whenFalse method

void whenFalse(
  1. void action()
)

Executes the action only if the boolean is false.

Example:

bool flag = false;
flag.whenFalse(() => print("Flag is false"));
Output: Flag is false

Implementation

void whenFalse(void Function() action) {
  if (!this) action();
}