query method

List<T> query(
  1. Rect area
)

Implementation

List<T> query(Rect area) {
  final queryBounds = _validatedBounds(area, 'area');
  final seen = <T>{};
  final results = <T>[];

  for (final key in _cells(queryBounds)) {
    final ids = _cellMap[key];
    if (ids == null) continue;
    for (final id in ids) {
      if (!seen.add(id)) continue;
      final bounds = _boundsById[id]!;
      if (bounds.left <= queryBounds.right &&
          bounds.right >= queryBounds.left &&
          bounds.top <= queryBounds.bottom &&
          bounds.bottom >= queryBounds.top) {
        results.add(id);
      }
    }
  }

  return results;
}