apply method

  1. @override
PolylineOp apply(
  1. List<InteractivePolyline<Object>> list
)
override

Applies this operation to the current list.

Modifies current in place and returns the effective operation (e.g. populated with captured state like removed index).

Implementation

@override
PolylineOp apply(List<InteractivePolyline> list) {
  final idx = list.indexWhere((p) => p.key == key);
  if (idx >= 0) {
    final target = list[idx];
    final newPoints = List<LatLng>.from(target.points);
    if (index >= 0 && index < newPoints.length) {
      newPoints[index] = to;
      list[idx] = target.copyWith(points: newPoints);
    }
  }
  return this;
}