elementAt method

MiniSubscription<T>? elementAt(
  1. int position
)

Implementation

MiniSubscription<T>? elementAt(int position) {
  if (isEmpty || position < 0 || position >= _length) return null;

  var node = _head;
  var current = 0;

  while (current != position) {
    node = node!.next;
    current++;
  }
  return node!.data;
}