getSpanForPositionVisitor method Null safety

  1. @override
InlineSpan? getSpanForPositionVisitor(
  1. TextPosition position,
  2. Accumulator offset
)
override

Performs the check at each InlineSpan for if the position falls within the range of the span and returns the span if it does.

The offset parameter tracks the current index offset in the text buffer formed if the contents of the InlineSpan tree were concatenated together starting from the root InlineSpan.

This method should not be directly called. Use getSpanForPosition instead.

Implementation

@override
InlineSpan? getSpanForPositionVisitor(TextPosition position, Accumulator offset) {
  if (position.offset == offset.value) {
    return this;
  }
  offset.increment(1);
  return null;
}