ObjectPool<T> class

Generic object pool for recycling objects

Constructors

ObjectPool({required T factory(), void resetFn(T)?, int maxPoolSize = 1000})
Creates a new object pool factory: Function to create new instances resetFn: Optional function to reset object state for reuse maxPoolSize: Maximum objects to keep in pool (default: 1000)

Properties

hashCode int
The hash code for this object.
no setterinherited
poolSize int
Get current pool size
no setter
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

acquire() → T
Acquire an object from the pool or create a new one
clear() → void
Clear all pooled objects
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
release(T object) → void
Release an object back to the pool for reuse
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited