visitTextSpan method

  1. @override
  2. @Deprecated('Use to visitChildren instead')
bool visitTextSpan (bool visitor(TextSpan span))
@Deprecated('Use to visitChildren instead'), override

Walks this TextSpan and any descendants in pre-order and calls visitor for each span that has content.

When visitor returns true, the walk will continue. When visitor returns false, then the walk will end.

Implementation

@override
@Deprecated('Use to visitChildren instead')
bool visitTextSpan(bool visitor(TextSpan span)) {
  if (text != null) {
    if (!visitor(this))
      return false;
  }
  if (children != null) {
    for (InlineSpan child in children) {
      assert(child is TextSpan, 'visitTextSpan is deprecated. Use visitChildren to support InlineSpans');
      final TextSpan textSpanChild = child;
      if (!textSpanChild.visitTextSpan(visitor))
        return false;
    }
  }
  return true;
}