insertSegment method

void insertSegment({
  1. required int segmentIndex,
  2. required Segment segment,
})

Inserts a segment into the part at the specified index.

The new segment is inserted at the specified segment_index. This index may be equal to the segment count which is equivalent to adding to the end of the collection. The number of points in the part increases to connect in the new segment.

Parameters:

  • segmentIndex — Zero-based index of the segment.
  • segment — The segment to insert.

Implementation

void insertSegment({
  required int segmentIndex,
  required Segment segment,
}) {
  _withThrowingErrorHandler((errorHandler) {
    runtimecore.RT_MutablePart_insertSegment(
      _handle,
      segmentIndex,
      segment._handle,
      errorHandler,
    );
  });
}