getSemanticsInfo method

Map<int, List<List<InlineSpanSemanticsInformation>>> getSemanticsInfo({
  1. bool combined = false,
})

Implementation

Map<int, List<List<InlineSpanSemanticsInformation>>> getSemanticsInfo({
  bool combined = false,
}) {
  final semanticsInfo = <int, List<List<InlineSpanSemanticsInformation>>>{};

  var textIndex = 0;

  var i = 0;
  for (final el in _textAndWidgets) {
    if (el is Widget) {
      // Add a placeholder for each regular child widget.
      semanticsInfo[i] = [
        [InlineSpanSemanticsInformation.placeholder]
      ];
    } else if (el is WrappableText) {
      final wtr = _cache[textIndex++];
      semanticsInfo[i] = [
        for (final textRenderer in wtr.renderers)
          textRenderer.getSemanticsInfo(combined: combined)
      ];
    } else {
      assert(false);
    }

    i++;
  }

  return semanticsInfo;
}