BoolList.generate constructor
Generates a BoolList of values.
Creates a BoolList with length
positions and fills it with values
created by calling generator
for each index in the range
0
.. length - 1
in increasing order.
The created list is fixed-length unless growable
is true.
Implementation
factory BoolList.generate(
int length,
bool Function(int) generator, {
bool growable = true,
}) {
RangeError.checkNotNegative(length, 'length');
var instance = BoolList._selectType(length, growable);
for (var i = 0; i < length; i++) {
instance._setBit(i, generator(i));
}
return instance;
}