firstOrNull method

E? firstOrNull({
  1. bool f(
    1. E e
    )?,
})

Implementation

E? firstOrNull({bool f(E e)?}) {
  if (f == null) return this.isEmpty ? null : first;
  for (var value in this) {
    if (f(value)) return value;
  }
  return null;
}