firstOrNull method

E? firstOrNull(
  1. bool test(
    1. E element
    )
)

Implementation

E? firstOrNull(bool test(E element)) {
  for (var e in this) {
    if (test(e)) {
      return e;
    }
  }
  return null;
}