setClass function

void setClass (
  1. Element element,
  2. String className,
  3. bool value
)

Add className to element CSS classes if value is true, Remove it otherwise.

Implementation

void setClass(Element element, String className, bool value) {
  if (value)
    element.classes.add(className);
  else
    element.classes.remove(className);
}