globalToLocalPosition method

  1. @override
TextPosition globalToLocalPosition(
  1. TextPosition position
)
override

Returns the position relative to the node content

The position must be within the node content

Implementation

@override
TextPosition globalToLocalPosition(TextPosition position) {
  assert(getContainer().containsOffset(position.offset),
      'The provided text position is not in the current node');
  return TextPosition(
    offset: position.offset - getContainer().documentOffset,
    affinity: position.affinity,
  );
}