toggleAttr method
Toggles a boolean attribute on the element.
Implementation
bool toggleAttr(String name, [bool? force]) {
if (_element == null) return false;
final shouldAdd = force ?? !hasAttr(name);
if (shouldAdd) {
_element!.setAttribute(name, '');
} else {
_element!.removeAttribute(name);
}
return shouldAdd;
}