setClassesMapped method

NodeBuilder setClassesMapped(
  1. Iterable<String> f(
    1. List<String>
    )
)

Implementation

NodeBuilder setClassesMapped(Iterable<String> Function(List<String>) f) {
  var clazz = attributes['class'];
  var classes = <String>[];

  if (clazz is String) {
    classes.addAll(clazz.split(' '));
  } else if (clazz is Iterable) {
    classes.addAll(clazz.map((s) => s.toString()));
  }

  return setClasses(f(classes));
}