toBool method

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

Converts the integer to a boolean.

Returns true if the value matches the given value, otherwise false.

Example:

print(1.toBool()); // true
print(0.toBool()); // false
print(5.toBool(5)); // true

Implementation

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