toInt method

int toInt()

Converts the boolean to an integer (true -> 1, false -> 0).

Example:

true.toInt(); // 1
false.toInt(); // 0

Implementation

int toInt() => this ? 1 : 0;