collectLeafFragments static method

List<Fragment> collectLeafFragments(
  1. FNode node
)

Recursively collects all leaf fragments in order. A leaf fragment is a Fragment that is not an InlineContainerNode.

Implementation

static List<Fragment> collectLeafFragments(FNode node) {
  final result = <Fragment>[];
  if (node is Fragment && node is! InlineContainerNode) {
    result.add(node);
  } else if (node is InlineContainerNode) {
    for (final child in (node as InlineContainerNode).getChildren()) {
      result.addAll(collectLeafFragments(child));
    }
  }
  return result;
}