elementAtOrNull method

T? elementAtOrNull(
  1. int index
)

The indexth element, or null if there is no such element.

Returns the element at position index of this iterable, just like elementAt, if this iterable has such an element. If this iterable does not have enough elements to have one with the given index, the null value is returned, unlike elementAt which throws instead.

The index must not be negative.

Implementation

T? elementAtOrNull(int index) => skip(index).firstOrNull;