getDeclarations method

Map<String, Map<String, List<Expression>>> getDeclarations(
  1. StyleSheet sheet
)

Implementation

Map<String, Map<String, List<css.Expression>>> getDeclarations(css.StyleSheet sheet) {
  for (var element in sheet.topLevels) {
    if (element.span != null) {
      _selector = element.span!.text;
      element.visit(this);
      if (_result[_selector] != null) {
        _properties.forEach((key, value) {
          if (_result[_selector]![key] != null) {
            _result[_selector]![key]!.addAll(List<css.Expression>.from(value));
          } else {
            _result[_selector]![key] = List<css.Expression>.from(value);
          }
        });
      } else {
        _result[_selector] = Map<String, List<css.Expression>>.from(_properties);
      }
      _properties.clear();
    }
  }
  return _result;
}