21 lines
469 B
Dart
21 lines
469 B
Dart
extension ListExtension<E> on List<E> {
|
|
bool containsAll(List<E> otherList) {
|
|
List<bool> checks = <bool>[];
|
|
//
|
|
for (E thisElement in otherList) {
|
|
checks.add(contains(thisElement));
|
|
}
|
|
return !checks.contains(false);
|
|
}
|
|
|
|
List<E> getUnique() {
|
|
List<E> uniqueItems = <E>[];
|
|
for (E thisElement in this) {
|
|
if (!uniqueItems.contains(thisElement)) {
|
|
uniqueItems.add(thisElement);
|
|
}
|
|
}
|
|
return uniqueItems;
|
|
}
|
|
}
|