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