visitChildren method

  1. @override
bool visitChildren(
  1. InlineSpanVisitor visitor
)
override

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

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

Implementation

@override
bool visitChildren(InlineSpanVisitor visitor) {
  if (text != null && !visitor(this)) {
    return false;
  }
  final List<InlineSpan>? children = this.children;
  if (children != null) {
    for (final InlineSpan child in children) {
      if (!child.visitChildren(visitor)) {
        return false;
      }
    }
  }
  return true;
}