queryChild method
Queries the child Node at offset in this container.
The result may contain the found node or null if no node is found
at specified offset.
ChildQuery.offset is set to relative offset within returned child node
which points at the same character position in the document as the
original offset.
Implementation
ChildQuery queryChild(int offset, bool inclusive) {
if (offset < 0 || offset > length) {
return ChildQuery(null, 0);
}
for (final node in children) {
final len = node.length;
if (offset < len || (inclusive && offset == len && node.isLast)) {
return ChildQuery(node, offset);
}
offset -= len;
}
return ChildQuery(null, 0);
}