toInt method

int toInt()

Converts the boolean value to an integer.

Returns:

  • 1 for true
  • 0 for false

Example: dart true.toInt(); // 1

Implementation

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