toggle method - CssClassSet class - dart:html library (original) (raw)
toggle abstract method
bool toggle(
Adds the class value
to the element if it is not on it, removes it if it is.
If shouldAdd
is true, then we always add that value
to the element. IfshouldAdd
is false then we always remove value
from the element.
If this corresponds to one element, returns true
if value
is present after the operation, and returns false
if value
is absent after the operation.
If this CssClassSet corresponds to many elements, false
is always returned.
value
must be a valid 'token' representing a single class, i.e. a non-empty string containing no whitespace. To toggle multiple classes, usetoggleAll.
Implementation
bool toggle(String value, [bool? shouldAdd]);