ObjectPool<T> constructor

ObjectPool<T>({
  1. required T create(),
  2. void reset(
    1. T item
    )?,
  3. void dispose(
    1. T item
    )?,
  4. int maxCapacity = 200,
})

Implementation

ObjectPool({
  required T Function() create,
  void Function(T item)? reset,
  void Function(T item)? dispose,
  this.maxCapacity = 200,
}) : _create = create,
     _reset = reset,
     _dispose = dispose {
  if (maxCapacity <= 0) {
    throw ArgumentError.value(
      maxCapacity,
      'maxCapacity',
      'must be greater than 0',
    );
  }
}