toggle method

void toggle(
  1. WidgetEvent event, [
  2. bool? active
])

Mutator to mark a T value as either active or inactive.

Implementation

void toggle(WidgetEvent event, [bool? active]) {
  active = active ?? !value.contains(event);
  return active ? add(event) : remove(event);
}