getPositionForOffset method

TextPosition getPositionForOffset (Offset offset)

Returns the text position closest to the given offset.

Implementation

TextPosition getPositionForOffset(Offset offset) {
  final List<int> encoded = _getPositionForOffset(offset.dx, offset.dy);
  return TextPosition(offset: encoded[0], affinity: TextAffinity.values[encoded[1]]);
}