mirror of
https://gitlab.com/nkming2/nc-photos.git
synced 2025-01-22 16:56:19 +01:00
9 lines
279 B
Dart
9 lines
279 B
Dart
extension ListExtension<T> on List<T> {
|
|
/// Return a new list with only distinct elements
|
|
List<T> distinct() {
|
|
final s = Set();
|
|
return this.where((element) => s.add(element)).toList();
|
|
}
|
|
|
|
Iterable<T> takeIndex(List<int> indexes) => indexes.map((e) => this[e]);
|
|
}
|