calculateOffsetForCaret static method
Returns the (x,y) offset for a caret, if that caret appeared at the given position.
By default, this method expects a single SuperEditor in the widget tree and
finds it byType. To specify one SuperEditor among many, pass a superEditorFinder.
Implementation
static Offset calculateOffsetForCaret(DocumentPosition position, [Finder? finder]) {
  final documentLayout = findDocumentLayout(finder);
  final positionRect = documentLayout.getRectForPosition(position);
  assert(positionRect != null);
  return positionRect!.topLeft;
}