buildStyledChars method

void buildStyledChars(
  1. List<StyledChar> output,
  2. Style parentStyle
)

Recursively flattens the styling tree into a list of styled characters.

Implementation

void buildStyledChars(List<StyledChar> output, Style parentStyle) {
  // Merge parent style with current span style.
  final mergedStyle = style != null ? parentStyle.merge(style!) : parentStyle;

  if (text != null) {
    for (final char in text!.characters) {
      output.add(StyledChar(char, mergedStyle));
    }
  }

  for (final child in children) {
    child.buildStyledChars(output, mergedStyle);
  }
}