listWithLengthInRange<T> method
A generator that returns Lists with a length
between min
, inclusive,
and max
, exclusive.
Implementation
Generator<core.List<T>> listWithLengthInRange<T>(
core.int? min,
core.int? max,
Generator<T> item,
) {
final actualMin = min ?? 0;
assert(actualMin >= 0);
return (random, size) {
final length = random.nextIntInRange(
actualMin,
math.max(max ?? size, actualMin + 1),
);
return ShrinkableList(
<Shrinkable<T>>[for (var i = 0; i < length; i++) item(random, size)],
actualMin,
);
};
}