PointPool constructor

PointPool({
  1. required int capacity,
})

Constructs a PointPool with the given capacity.

  • capacity: The number of points the pool can hold.

Implementation

PointPool({required super.capacity})
    : _pointers =
          List.generate(capacity, (_) => calloc<Point>(), growable: false),
      _pointerToIndex = {} {
  // Initialize pointer to index mapping
  for (var i = 0; i < capacity; i++) {
    _pointerToIndex[_pointers[i]] = i;
  }
}