coerceValue method Null safety

num coerceValue(
  1. List<String> newNumerators,
  2. List<String> newDenominators,
  3. [String? name]
)

Returns value, converted to the units represented by newNumerators and newDenominators.

This does not throw an error if this number is unitless and newNumerators/newDenominators are not empty, or vice versa. Instead, it treats all unitless numbers as convertible to and from all units without changing the value.

Throws a SassScriptException if this number's units aren't compatible with newNumerators and newDenominators.

If this came from a function argument, name is the argument name (without the $). It's used for error reporting.

Implementation

num coerceValue(List<String> newNumerators, List<String> newDenominators,
        [String? name]) =>
    _coerceOrConvertValue(newNumerators, newDenominators,
        coerceUnitless: true, name: name);