add method

void add(
  1. T item,
  2. MapRectangle boundary
)

Adds a render item to the spatial index.

The item is added to all grid cells that intersect with its boundary. Items without boundaries are ignored for performance.

item Render item to add to the index

Implementation

void add(T item, MapRectangle boundary) {
  final cells = _getCells(boundary);
  for (final cell in cells) {
    _grid.putIfAbsent(cell, () => <T>[]).add(item);
  }
}