toInt method

int toInt()

Converts the boolean value to an integer.

Returns:

  • 1 for true
  • 0 for false or null

Example: dart bool? flag = true; flag.toInt(); // 1

Implementation

int toInt() => validate().toInt();