getOrNull method

T? getOrNull(
  1. int index
)

Returns an element at the given index or null if the index is out of bounds of this list.

Implementation

T? getOrNull(int index) {
  return index >= 0 && index <= lastIndex ? get(index) : null;
}