LabeledList<E>.generate constructor
LabeledList<E>.generate (})
Generates a LabeledList of values, as returned by generator
.
If labels
are provided, there must be a label or a null
value for
every element in in the list. labels.length
must equal the length of
the list.
If growable
is false
, the returned list will be a fixed-length
list, otherwise the list is growable and identical to the default
constructor.
Implementation
LabeledList.generate(
int length,
Generator<E> generator, {
Iterable<String?>? labels,
bool growable = true,
}) : assert(length >= 0),
assert(labels == null || labels.length == length),
_labels = _buildLabels(labels, length, growable: growable),
super(List<E>.generate(length, generator, growable: growable),
growable: growable);