atOr method

T atOr(
  1. int index,
  2. T value
)

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

Implementation

T atOr(int index, T value) => isIndexValid(index) ? elementAt(index) : value;