resolveContent static method

dynamic resolveContent(
  1. String? content
)

Implementation

static dynamic resolveContent(String? content) {
  if (content == null) return null;

  if (content.startsWith('\'') || content.startsWith('"')) {
    String trimContent = removeQuotationMark(content);

    if (trimContent.startsWith('\\')) {
      String rawInput = trimContent.substring(1);
      List<int> unicodes = rawInput.split('\\').map((e) => int.parse(e, radix: 16)).toList();
      trimContent = String.fromCharCodes(unicodes);
    }

    return QuoteStringContentValue(trimContent);
  }

  if (CSSFunction.isFunction(content)) {
    return FunctionContentValue(CSSFunction.parseFunction(content));
  }

  return KeywordContentValue(content);
}