toggleMarker method

void toggleMarker(
  1. MapCellData cell
)

Adds or removes a marker at the given location.

Implementation

void toggleMarker(MapCellData cell) {
  if (markers.any(
    (e) =>
        e.toGridBlock(centerPosition) ==
        cell.coordinates.toGridBlock(centerPosition),
  )) {
    removeMarker(cell.coordinates);
  } else {
    placeMarker(cell.coordinates);
  }
}