toBool method

bool toBool([
  1. int value = 1
])

Converts the integer to a boolean, where 1 is true and all other values are false.

print(1.toBool()); // Output: true
print(0.toBool()); // Output: false

Implementation

bool toBool([int value = 1]) => validate().toBool(value);