partition method
Splits the iterable into two lists based on the predicate.
Implementation
(List<E>, List<E>) partition(bool Function(E) predicate) {
final matching = <E>[];
final notMatching = <E>[];
for (final element in this) {
if (predicate(element)) {
matching.add(element);
} else {
notMatching.add(element);
}
}
return (matching, notMatching);
}