reassignOffsets method
Corrects the offsets of TextElement
s 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;
});
}