getFirst method

T? getFirst(
  1. T item
)

Get the first occurrence of item from the list. Returns null if the item was not found.

Implementation

T? getFirst(T item) {
  final index = indexOf(item);
  if (index == -1) return null;
  return this[index];
}