computeUnit method
Implementation
@override
CSSUnit? computeUnit([DOMContext? domContext]) {
if (args.isEmpty) return null;
var values = args.map((a) => CSSValue.from(a)).toList();
var valuesNotNull = values.nonNulls.toList();
if (valuesNotNull.length != values.length) return null;
var computed =
valuesNotNull.map((a) => CSSFunction.computeValue(a)).toList();
var computedNotNull = computed.nonNulls.toList();
if (computedNotNull.length != computed.length) return null;
var computedCSSLength = computedNotNull.whereType<CSSLength>();
if (computedCSSLength.length == computedNotNull.length) {
var firstUnit = computedCSSLength.first.unit;
if (computedCSSLength.every((a) => a.unit == firstUnit)) {
return firstUnit;
}
}
return null;
}