length property Null safety

int length

Returns the length of this list

Implementation

int get length {
  var length = 0;
  var currentNode = _head;

  while (currentNode != null) {
    currentNode = currentNode.next;
    length++;
  }
  return length;
}