toBool method

bool toBool()

Extension for integer (int) values to convert them to boolean (bool) values. Converts the integer to a boolean value: 1 for true, 0 for false.

Example:

int flag = 1;
print(flag.toBool()); // Output: true

Implementation

bool toBool() => this == 1;