setAttr method

void setAttr(
  1. String name,
  2. String? value
)

Sets an attribute on the element.

If value is null, the attribute is removed.

Implementation

void setAttr(String name, String? value) {
  if (_element == null) return;
  if (value == null) {
    _element!.removeAttribute(name);
  } else {
    _element!.setAttribute(name, value);
  }
}