You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
extension Unique<E, Id> on List<E> {
|
|
List<E> unique([Id Function(E element) id, bool inplace = true]) {
|
|
final ids = Set();
|
|
var list = inplace ? this : List<E>.from(this);
|
|
list.retainWhere((x) => ids.add(id != null ? id(x) : x as Id));
|
|
return list;
|
|
}
|
|
} |