firstOrNull<T> static method

T? firstOrNull<T>(
  1. Iterable<T>? list, {
  2. bool filter(
    1. T input
    )?,
})

Implementation

static T? firstOrNull<T>(Iterable<T>? list, {bool filter(T input)?}) {
  if (filter != null) {
    list = list?.where(filter);
  }
  return list?.isNotEmpty == true ? list?.first : null;
}