Dart newbie question.
List is a child class of Iterable, and some list methods return Iterable instead of List, e.g., List\'s where method. If we declare a variable
A List is an indexable collection of objects with a length.
List class
An iterable is a collection of values, or "elements", that can be accessed sequentially.
Iterable class
The elements of the iterable are accessed by getting an Iterator
Iterator class
Now, as you can see iterable does not have any add method. This is on purpose. We get following benefits from using iterable :
Note : The Iterable and Iterator classes support for-in loops. Extend (if possible) or implement Iterable whenever you create a class that can provide Iterators for use in for-in loops. Implement Iterator to define the actual iteration ability.