I am investigating Iterable and iterator of Dart (Flutter).

I got a rough idea of the rough mechanism of Iterable, iterator, etc.

Looking at the source code for the List type, which is a typical type of Iterable,

↓ First, the List class implements the abstract class EfficientLengthIterable class.

There is no description about the iterator property in the List class. I can't find any code that initializes the iterator property in the constructor.

//list.dart
abstract class List<E> implements EfficientLengthIterable<E> {
   ...

The superclass of the EfficientLengthIterable class is the Iterable class.

EfficientLengthIterable itself has no implementation code for the iterator property.

(The ListIterable class is defined a little below, and the ListIterable class has the iterator property initialization code.

However, I can't find any code that the List class inherits from ListIterable . )

//internal/iterable.dart
abstract class EfficientLengthIterable<T> extends Iterable<T> {
  const EfficientLengthIterable();
  int get length;
}

abstract class ListIterable<E> extends EfficientLengthIterable<E> {
   ...

The iterator property of the Iterable class is declared, but it is only declared and not initialized. (Because it's an abstract class, I think it's normal.)

//core/iterable.dart
abstract class Iterable<E> {
   ...
   Iterator<E> get iterator;
   ...

At a glance, it looks like this, and in this case, the iterator property of the instance of the List class is not initialized, so I feel that it will be null.

I don't think it's possible to iterate the list, In fact (as a matter of course) it can iterate normally.

Under the definition of the EfficientLengthIterable class,

ListIterable class

ListIterator class

there is a definition such as. And if the List class inherits the ListIterable class, I think there is no contradiction.

Even if I look at the name of class, it seems like it will be inherited. But I can't find any code that shows such a relationship.

If I look at it normally, the class hierarchy is

Superclass ← Iterable ← EfficientLengthIterable ← List ← Subclass

It only looks like. (Although List is not a subclass of EfficientLengthIterable, because implements are used.)

In the above class hierarchy, List cannot inherit the members of ListIterable (iterator property initialized by ListIterator instance), isn't it?

Is there code somewhere else that shows the relationship between the List and ListIterable classes?

Or does this code properly initialize the iterator property of an instance of the List class?