movePoint method

void movePoint({
  1. required Key key,
  2. required int index,
  3. required LatLng from,
  4. required LatLng to,
  5. bool merge = false,
})

Implementation

void movePoint({
  required Key key,
  required int index,
  required LatLng from,
  required LatLng to,
  bool merge = false,
}) {
  final p = findByKey(key);
  if (p == null) {
    debugPrint(
        'Warning: Attempted to move point of non-existent polyline with key: $key');
    return;
  }

  perform(
    MovePointPolylineOp(key: key, index: index, from: from, to: to),
    merge: merge,
  );
  scheduleAutoSave();
  // Note: Generic `update` won't be called automatically unless we used `update`.
  // But `PolylineOp.movePoint` updates the list.
  // Ideally we should use standard update if possible, but movePoint is granular transaction.
}