acquire method

T acquire()

Acquires an object from the pool. If the pool is empty, a new object is created using the factory.

Implementation

T acquire() {
  if (_pool.isNotEmpty) {
    return _pool.removeLast();
  }
  return _factory();
}