toggle method

void toggle()

Toogle the active class on the button. If the button is of radio type,

  • other associated buttons will react accordingly.

Implementation

void toggle() {
  final $parent = $element.closest('[data-toggle="buttons-radio"]');
  if ($parent.isNotEmpty)
    $parent.find('.active').removeClass('active');
  element.classes.toggle('active');
}