Dart: Iterable vs. List, always use Iterable?

后端 未结 3 2031
你的背包
你的背包 2020-12-30 23:28

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

3条回答
  •  攒了一身酷
    2020-12-30 23:55

    A List is completely concrete at its inception. An Iterable is a "lazy list", and might even be an infinite list. Iterables are computed as needed. They have similar properties, but different realizations.

提交回复
热议问题