partition method
Splits the collection into two lists according to predicate.
The first list contains elements for which predicate yielded true,
while the second list contains elements for which predicate yielded
false.
Implementation
List<List<E>> partition(bool Function(E element) predicate) {
final t = <E>[];
final f = <E>[];
for (final element in this) {
if (predicate(element)) {
t.add(element);
} else {
f.add(element);
}
}
return [t, f];
}