retrieve method Null safety
- Rect bounds
Return all objects that could collide with the given object, given bounds.
Implementation
List<O> retrieve(Rect bounds) {
final quadrants = getQuadrants(bounds);
final List<O> objects = [...this.objects];
/// Recursively retrieve objects from subnodes in the relevant quadrants.
if (nodes.isNotEmpty) {
for (final q in quadrants) {
objects.addAll(nodes[q]!.retrieve(bounds));
}
}
objects.removeDuplicates();
return objects;
}