toInt method
Converts the boolean value to an integer.
Returns 1 if the value is true, otherwise returns 0.
Example:
bool value = true;
print(value.toInt()); // 1
Implementation
int toInt() => this ? 1 : 0;
Converts the boolean value to an integer.
Returns 1 if the value is true, otherwise returns 0.
Example:
bool value = true;
print(value.toInt()); // 1
int toInt() => this ? 1 : 0;