toInt method
Converts the boolean to an integer: 1 if true, 0 if false.
Example:
bool flag = true;
print(flag.toInt()); // Output: 1
Implementation
int toInt() => this ? 1 : 0;
Converts the boolean to an integer: 1 if true, 0 if false.
Example:
bool flag = true;
print(flag.toInt()); // Output: 1
int toInt() => this ? 1 : 0;