reassignOffsets method

Iterable<TextElement> reassignOffsets({
  1. int startingOffset = 0,
})

Corrects the offsets of TextElements and returns a new lazy Iterable with the elements.

The offset of the first element is zero, or a different number if specified with startingOffset.

Implementation

Iterable<TextElement> reassignOffsets({int startingOffset = 0}) {
  var offset = startingOffset;
  return map((elm) {
    final newElm = elm.copyWith(offset: offset);
    offset += elm.text.length;
    return newElm;
  });
}