codeUnitAtVisitor method

  1. @override
int? codeUnitAtVisitor(
  1. int index,
  2. Accumulator offset
)
override

Performs the check at each InlineSpan for if the index falls within the range of the span and returns the corresponding code unit. Returns null otherwise.

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 codeUnitAt instead.

Implementation

@override
int? codeUnitAtVisitor(int index, Accumulator offset) {
  final int localOffset = index - offset.value;
  assert(localOffset >= 0);
  offset.increment(1);
  return localOffset == 0 ? PlaceholderSpan.placeholderCodeUnit : null;
}