visitChildren method Null safety

  1. @override
bool visitChildren(
  1. InlineSpanVisitor visitor

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.


bool visitChildren(InlineSpanVisitor visitor) {
  if (text != null) {
    if (!visitor(this))
      return false;
  if (children != null) {
    for (final InlineSpan child in children!) {
      if (!child.visitChildren(visitor))
        return false;
  return true;