toInt static method

int toInt(
  1. dynamic d,
  2. int def
)

Converts a dynamic value to a non-nullable integer.

d - The dynamic value to be converted. def - The default integer value if conversion fails. Returns an integer.

Implementation

static int toInt(dynamic d, int def) {
  return toIntN(d) ?? def;
}