removeDuplicates<I> method

void removeDuplicates<I>(
  1. I constraintMapper(
    1. E element
    )
)

Implementation

void removeDuplicates<I>(I Function(E element) constraintMapper) {
  final distinctList = map(constraintMapper).toSet();

  retainWhere((element) => distinctList.remove(constraintMapper(element)));
}