Returns the text position closest to the given offset.
Source
TextPosition getPositionForOffset(Offset offset) { List<int> encoded = _getPositionForOffset(offset.dx, offset.dy); return new TextPosition(offset: encoded[0], affinity: TextAffinity.values[encoded[1]]); }