updatePolygonGeofence method

Future<bool> updatePolygonGeofence(
  1. PolygonGeofence polygon
)

Updates an existing polygon geofence.

Returns true if updated, false if not found.

Implementation

Future<bool> updatePolygonGeofence(PolygonGeofence polygon) async {
  if (!_polygons.containsKey(polygon.identifier)) {
    return false;
  }

  if (!polygon.isValid) {
    throw ArgumentError('Invalid polygon geofence: ${polygon.identifier}');
  }

  _polygons[polygon.identifier] = polygon;
  await _persist();

  debugPrint(
      '[PolygonGeofenceService] Updated polygon: ${polygon.identifier}');
  return true;
}