addPoint method
void
addPoint(
- LatLng point
Adds a new LatLng point to the map and updates all visual elements.
Implementation
void addPoint(LatLng point) {
///
/// This method:
/// - Sets `_hasInteracted` to true to indicate user interaction.
/// - Wraps the [point] in a [MapPoint] with a unique ID.
/// - Adds the point to `_tappedPoints`.
/// - Clears the undo stack to maintain correct redo state.
/// - Creates a draggable marker for the point and adds it to `_markerMap`.
/// - Updates the map shapes (lines, polygons, midpoints, labels).
/// - Notifies listeners to trigger UI updates.
///
/// Use this when the user taps on the map to add a new boundary or measurement point.
_hasInteracted = true;
final mapPoint = MapPoint(id: UniqueKey().toString(), position: point);
_tappedPoints.add(mapPoint);
_undoStack.clear();
_markerMap[MarkerId(mapPoint.id)] = _createMarker(mapPoint);
_updateMapShapes();
notifyListeners();
}