StreamList<E>.from constructor
StreamList<E>.from (
- Iterable elements, {
- bool growable = true,
- OnUpdate<
List< ? onUpdate,E> > - OnEvent<
CollectionEvent< ? onEvent,int, E> > - OnChange<
CollectionChangeEvent< ? onChange,int, E> >
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 =
List<SubType>.from(superList.whereType<SubType>());
This constructor creates a growable list when growable
is true;
otherwise, it returns a fixed-length list.
Implementation
factory StreamList.from(
Iterable elements, {
bool growable = true,
OnUpdate<List<E>>? onUpdate,
OnEvent<CollectionEvent<int, E>>? onEvent,
OnChange<CollectionChangeEvent<int, E>>? onChange,
}) {
return StreamList(
value: List<E>.from(elements, growable: growable),
onUpdate: onUpdate,
onEvent: onEvent,
onChange: onChange,
);
}