BoolList.empty constructor

BoolList.empty(
  1. {bool growable = true,
  2. int capacity = 0}
)

Creates an empty list of booleans.

The list defaults to being growable unless growable is false. If capacity is provided, and growable is not false, the implementation will attempt to make space for that many elements before needing to grow its internal storage.

Implementation

factory BoolList.empty({bool growable = true, int capacity = 0}) {
  RangeError.checkNotNegative(capacity, 'length');

  if (growable) {
    return _GrowableBoolList._withCapacity(0, capacity);
  } else {
    return _NonGrowableBoolList._withCapacity(0, capacity);
  }
}