prewarm method

void prewarm(
  1. int count
)

Creates up to count objects ahead of time into the free list, so the first burst of real acquire calls doesn't pay allocation cost. Capped at maxCapacity — never over-fills the pool's resting size.

Implementation

void prewarm(int count) {
  final room = maxCapacity - (_free.length + _active.length);
  final toCreate = count < room ? count : room;
  for (var i = 0; i < toCreate; i++) {
    _free.add(_createNew());
  }
}