ObjectPool<T> constructor
ObjectPool<T> ({
- required T create(),
- void reset(
- T item
- void dispose(
- T item
- 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',
);
}
}