getOrElse method

T getOrElse(
  1. int index,
  2. T defaultValue(
    1. int
    )
)

Returns an element at the given index or the result of calling the defaultValue function if the index is out of bounds of this array.

Implementation

T getOrElse(int index, T Function(int) defaultValue) =>
    size < length - 1 ? get(index) : defaultValue(index);