assertInt method Null safety

int assertInt(
  1. [String? name]

Returns value as an int, if it's an integer value according to isInt.

Throws a SassScriptException if value isn't an integer. If this came from a function argument, name is the argument name (without the $). It's used for error reporting.


int assertInt([String? name]) {
  var integer = fuzzyAsInt(value);
  if (integer != null) return integer;
  throw _exception("$this is not an int.", name);