getElement method

E? getElement(
  1. int? index
)

Implementation

E? getElement(int? index) {
  if (this == null || index == null || index >= this!.length || index < 0) {
    return null;
  }
  int elementIndex = 0;
  for (E element in this!) {
    if (index == elementIndex) return element;
    elementIndex++;
  }
  return null;
}