toggleValue method

void toggleValue(
  1. T value
)

Toggle a value in list if value exists, remove it if value does not exist, add it

Implementation

void toggleValue(T value) {
  if (contains(value)) {
    remove(value);
    return;
  }
  add(value);
}