tryParse static method
Implementation
static CSSVariable? tryParse(RenderStyle renderStyle, String propertyName, String propertyValue) {
// font-size: var(--x);
// font-size: var(--x, 28px);
if (CSSFunction.isFunction(propertyValue, functionName: VAR)) {
List<CSSFunctionalNotation> fns = CSSFunction.parseFunction(propertyValue);
if (fns.first.args.isNotEmpty) {
if (fns.first.args.length > 1) {
// Has default value for CSS Variable.
return CSSVariable(fns.first.args.first, renderStyle,
defaultValue: fns.first.args.last);
} else {
return CSSVariable(fns.first.args.first, renderStyle);
}
}
}
}