find method

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

查找符合条件的元素。

Implementation

E? find(bool Function(E element) test) {
  final list = where(test);
  return list.isEmpty ? null : list.first;
}