ObjectPool<T extends PoolAble> constructor
ObjectPool<T extends PoolAble> ({
- required int withCapacity,
- required T object,
Implementation
ObjectPool({required int withCapacity, required T object}) {
if (withCapacity <= 0) {
throw Exception(
"Object Pool must be instantiated with a capacity greater than 0!");
}
this.desiredCapacity = 5;
this.objects = List.filled(this.desiredCapacity, null, growable: false);
this.objectsPointer = 0;
this.modelObject = object;
this.replenishPercentage = 1.0;
this.refillPool1();
}