TextPosition getPositionForOffset(Offset offset)

Returns the position within the text for the given pixel offset.

Source

TextPosition getPositionForOffset(Offset offset) {
  assert(!_needsLayout);
  return _paragraph.getPositionForOffset(offset);
}