min static method
Creates a min()
calculation with the given arguments
.
Each argument must be either a SassNumber, a SassCalculation, an unquoted SassString, or a CalculationOperation. It must be passed at least one argument.
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 min(Iterable<Object> arguments) {
var args = _simplifyArguments(arguments);
if (args.isEmpty) {
throw ArgumentError("min() must have at least one argument.");
}
SassNumber? minimum;
for (var arg in args) {
if (arg is! SassNumber ||
(minimum != null && !minimum.isComparableTo(arg))) {
minimum = null;
break;
} else if (minimum == null || minimum.greaterThan(arg).isTruthy) {
minimum = arg;
}
}
if (minimum != null) return minimum;
_verifyCompatibleNumbers(args);
return SassCalculation._("min", args);
}