revert method

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

Reverts this operation from the current list.

Modifies current in place and returns the operation itself (or reversed op).

Implementation

@override
PolylineOp revert(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] = from;
      list[idx] = target.copyWith(points: newPoints);
    }
  }
  return this;
}