visitChildren method

  1. @override
bool visitChildren (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) {
    if (!visitor(this))
      return false;
  }
  if (children != null) {
    for (InlineSpan child in children) {
      if (!child.visitChildren(visitor))
        return false;
    }
  }
  return true;
}