collectStyle method

Style collectStyle(
  1. int index,
  2. int len
)

Only attributes applied to all characters within this range are included in the result.

Implementation

Style collectStyle(int index, int len) {
  final res = queryChild(index);
  Style rangeStyle;
  if (len > 0) {
    return (res.node as Line).collectStyle(res.offset, len);
  }
  if (res.offset == 0) {
    return rangeStyle = (res.node as Line).collectStyle(res.offset, len);
  }
  rangeStyle = (res.node as Line).collectStyle(res.offset - 1, len);
  final linkAttribute = rangeStyle.attributes[Attribute.link.key];
  if ((linkAttribute != null) &&
      (linkAttribute.value !=
          (res.node as Line)
              .collectStyle(res.offset, len)
              .attributes[Attribute.link.key]
              ?.value)) {
    return rangeStyle.removeAll({linkAttribute});
  }
  return rangeStyle;
}