LabeledList<E>.filled constructor

LabeledList<E>.filled(
  1. int length,
  2. E fill, {
  3. Iterable<String?>? labels,
  4. bool growable = false,
})

Constructs a new LabeledList of the given length with fill for every element.

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.filled(
  int length,
  E fill, {
  Iterable<String?>? labels,
  bool growable = false,
})  : assert(length >= 0),
      assert(labels == null || labels.length == length),
      _labels = _buildLabels(labels, length, growable: growable),
      super(List<E>.filled(length, fill, growable: growable),
          growable: growable);