removeDuplicates<T> function

List<T> removeDuplicates<T>(
  1. List<T> list,
  2. IsEqual isEqual
)

Implementation

List<T> removeDuplicates<T>(List<T> list, IsEqual isEqual) {
  List<T> output = [];
  for (var i = 0; i < list.length; i++) {
    bool found = false;
    for (var j = 0; j < output.length; j++) {
      if (isEqual(list[i], output[j])) {
        found = true;
      }
    }
    if (!found) {
      output.add(list[i]);
    }
  }

  return output;
}