BoolList constructor

BoolList(
  1. int length,
  2. {bool fill = false,
  3. bool growable = false}
)

Creates a list of booleans with the provided length.

The list is initially filled with the fill value, and the list is growable if growable is true.

Implementation

factory BoolList(int length, {bool fill = false, bool growable = false}) {
  RangeError.checkNotNegative(length, 'length');

  BoolList boolList;
  if (growable) {
    boolList = _GrowableBoolList(length);
  } else {
    boolList = _NonGrowableBoolList(length);
  }

  if (fill) {
    boolList.fillRange(0, length, true);
  }

  return boolList;
}