tryParserCSSColorWithVariable static method

String tryParserCSSColorWithVariable(
  1. String fullColor,
  2. String input,
  3. RenderStyle renderStyle,
  4. String propertyName,
)

Implementation

static String tryParserCSSColorWithVariable(
    String fullColor, String input, RenderStyle renderStyle, String propertyName) {
  final String replaced = replaceCssVarFunctions(input, (String varString) {
    var variable = renderStyle.resolveValue(propertyName, varString);

    if (variable is CSSVariable) {
      String? resolved = renderStyle.getCSSVariable(variable.identifier, '${propertyName}_$fullColor')?.toString();

      return resolved ?? '';
    }
    return '';
  });

  return replaced;
}