8 lines
176 B
Dart
8 lines
176 B
Dart
E? findWhere<E>(List<E> elements, bool Function(E element) test) {
|
|
for (final element in elements) {
|
|
if (test(element)) {
|
|
return element;
|
|
}
|
|
}
|
|
return null;
|
|
} |