childAtPosition method

RenderEditableBox childAtPosition(
  1. TextPosition position
)

Implementation

RenderEditableBox childAtPosition(TextPosition position) {
  assert(firstChild != null);

  final targetNode = container.queryChild(position.offset, false).node;

  var targetChild = firstChild;
  while (targetChild != null) {
    if (targetChild.container == targetNode) {
      break;
    }
    final newChild = childAfter(targetChild);
    if (newChild == null) {
      break;
    }
    targetChild = newChild;
  }
  if (targetChild == null) {
    throw 'targetChild should not be null';
  }
  return targetChild;
}