parse static method
Implementation
static CSSCalc? parse(String? calc) {
if (calc == null) return null;
calc = calc.trim().toLowerCase();
if (calc.isEmpty) return null;
var match = pattern.firstMatch(calc);
if (match == null) return null;
var expression = match.group(1)!;
var matchExpresionOp = patternExpressionOperation.firstMatch(expression);
if (matchExpresionOp != null) {
var a = matchExpresionOp.group(1)!;
var op = getCalcOperation(matchExpresionOp.group(2));
var b = matchExpresionOp.group(3);
return CSSCalc.withOperation(a, op, b);
} else {
return CSSCalc.simpleExpression(expression.trim());
}
}