describeSemantics method Null safety

void describeSemantics(
  1. Accumulator offset,
  2. List<int> semanticsOffsets,
  3. List semanticsElements
)

Populates the semanticsOffsets and semanticsElements with the appropriate data to be able to construct a SemanticsNode.

PlaceholderSpans have a text length of 1, which corresponds to the object replacement character (0xFFFC) that is inserted to represent it.

Null is added to semanticsElements for PlaceholderSpans.

Implementation

void describeSemantics(Accumulator offset, List<int> semanticsOffsets, List<dynamic> semanticsElements) {
  semanticsOffsets.add(offset.value);
  semanticsOffsets.add(offset.value + 1);
  semanticsElements.add(null); // null indicates this is a placeholder.
  offset.increment(1);
}