BoolList constructor Null safety

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 boolist;
  if (growable) {
    boolist = _GrowableBoolList(length);
  } else {
    boolist = _NonGrowableBoolList(length);
  }

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

  return boolist;
}