allocate method
Allocates a Point from the pool.
Returns a pointer to the allocated Point, or null if no free slot is available.
Implementation
Pointer<Point>? allocate() {
if (isDisposed) {
throw StateError('Cannot allocate from disposed pool');
}
final index = _findFreeIndex();
if (index != -1 && _markUsed(index)) {
return _pointers[index];
}
return null;
}