/Dart 2

List<E>.from constructor

List<E>.from(Iterable elements, { bool growable: true })

Creates a list containing all elements.

The Iterator of elements provides the order of the elements.

All the elements should be instances of E. The elements iterable itself may have any element type, so this constructor can be used to down-cast a List, for example as:

List<SuperType> superList = ...;
List<SubType> subList =
    new List<SubType>.from(superList.whereType<SubType>());

This constructor creates a growable list when growable is true; otherwise, it returns a fixed-length list.


external factory List.from(Iterable elements, {bool growable = true});

© 2012 the Dart project authors
Licensed under the Creative Commons Attribution-ShareAlike License v4.0.