undoLastPoint method
void
undoLastPoint()
Removes the last tapped point and updates shapes.
Implementation
void undoLastPoint() {
/// - Removes the last point in `_tappedPoints`.
/// - Adds the removed point to the `_undoStack` for potential redo.
/// - Removes its corresponding marker from `_markerMap`.
/// - Updates all map shapes (polygons, polylines, midpoints, labels).
/// - Notifies listeners to refresh the UI.
///
/// Safe to call only if at least one point has been added.
if (_tappedPoints.isNotEmpty) {
final removed = _tappedPoints.removeLast();
_undoStack.add(removed);
_markerMap.remove(MarkerId(removed.id));
_updateMapShapes();
notifyListeners();
}
}