W3cubDocs

/Dart 2

readClasses method

Set<String> readClasses ()

Read the class names from the Element class property, and put them into a set (duplicates are discarded). This is intended to be overridden by specific implementations.

Implementation

Set<String> readClasses() {
  var classname = _element.attributes['class'];
  if (classname is AnimatedString) {
    classname = (classname as AnimatedString).baseVal;
  }

  Set<String> s = new LinkedHashSet<String>();
  if (classname == null) {
    return s;
  }
  for (String name in classname.split(' ')) {
    String trimmed = name.trim();
    if (!trimmed.isEmpty) {
      s.add(trimmed);
    }
  }
  return s;
}

© 2012 the Dart project authors
Licensed under the Creative Commons Attribution-ShareAlike License v4.0.
https://api.dart.dev/stable/2.5.0/dart-svg/AttributeClassSet/readClasses.html