distinctBy method

Iterable<T> distinctBy(
  1. Object getCompareValue(
    1. T e
    )
)

Implementation

Iterable<T> distinctBy(Object Function(T e) getCompareValue) {
  var result = <T>[];
  forEach((element) {
    if (!result.any((x) => getCompareValue(x) == getCompareValue(element))) {
      result.add(element);
    }
  });

  return result;
}