calc method Null safety

Value calc(
  1. Object argument
)

Creates a calc() calculation with the given argument.

The argument must be either a SassNumber, a SassCalculation, an unquoted SassString, a CalculationOperation, or a CalculationInterpolation.

This automatically simplifies the calculation, so it may return a SassNumber rather than a SassCalculation. It throws an exception if it can determine that the calculation will definitely produce invalid CSS.

Implementation

static Value calc(Object argument) {
  argument = _simplify(argument);
  if (argument is SassNumber) return argument;
  if (argument is SassCalculation) return argument;
  return SassCalculation._("calc", List.unmodifiable([argument]));
}