addOrReplace method

void addOrReplace(
  1. dynamic model
)

? Add value to list if doesn't exist else replace Current Value

Implementation

void addOrReplace(model) {
  if (contains(model)) {
    insert(indexOf(model), model);
    removeAt(indexOf(model));
  } else {
    add(model);
  }
}