release method

void release(
  1. T object
)

Releases an object back to the pool.

If the pool is full, the object is discarded and will be garbage collected.

Implementation

void release(T object) {
  if (_pool.length < _maxSize) {
    _reset?.call(object);
    _pool.add(object);
  }
  // If pool is full, let object be garbage collected
}