distinctBy method
Returns a list of distinct elements
Implementation
List<T> distinctBy(Function(T element) a) {
HashSet idServers = new HashSet();
List<T> newList = List.from(this);
for (int i = 0; i < newList.length; i++) {
final value = a(newList[i]);
if (!idServers.add(value)) {
/// Do the -- no i because removing an item from the list and not doing that it will skip the next one
newList.removeAt(i--);
}
}
return newList;
}