uniqueBy method Null safety

Iterable<T> uniqueBy(
  1. dynamic uniqueProp(
    1. T item
    )
)

Implementation

Iterable<T> uniqueBy(dynamic uniqueProp(T item)) {
  final mapping = <dynamic, T>{};
  for (final t in this) {
    final unique = uniqueProp(t);
    mapping[unique] = t;
  }
  return mapping.values;
}