text property

  1. @override
String get text
inherited

Return the combined text of all child nodes. This method only considers tokens which have been added to the parse tree.

Since tokens on hidden channels (e.g. whitespace or comments) are not added to the parse trees, they will not appear in the output of this method.

Implementation

@override
String get text {
  if (childCount == 0) {
    return '';
  }

  final builder = StringBuffer();
  for (var i = 0; i < childCount; i++) {
    builder.write(getChild(i)!.text);
  }

  return builder.toString();
}