removeObject method
Implementation
bool removeObject(T obj) {
var point = _objectPoint[obj];
if (point == null) return false;
var x = _getCoord(point.x), y = _getCoord(point.y);
var row = _grid[y] ??= {};
var cell = row[x] ??= [];
_objectPoint.remove(obj);
for (var i = 0, len = cell.length; i < len; i++) {
if (cell[i] == obj) {
cell.removeAt(i);
if (len == 1) {
row.remove(x);
if (_grid[y]!.isEmpty) {
_grid.remove(y);
}
}
return true;
}
}
return false;
}