addToSet method

void addToSet(
  1. T value
)

Adds value to the list only if it does not already exist.

Implementation

void addToSet(T value) {
  if (!contains(value)) add(value);
}