childrenOf function

List<FNode> childrenOf(
  1. FNode node
)

Returns the direct children of node for any type, including Root, FluentList, FluentTable/FluentRow. It's the base function to use everywhere instead of direct getChildren().

Implementation

List<FNode> childrenOf(FNode node) {
  if (node is Root) return List<FNode>.from(node.nodes);
  if (node is FluentTable) {
    return node.getChildren().cast<FNode>();
  }
  if (node is FluentRow) {
    return node.getChildren().cast<FNode>();
  }
  if (node is FluentList) {
    return node.getChildren().cast<FNode>();
  }
  if (node is InlineContainerNode) {
    return (node as InlineContainerNode).getChildren().cast<FNode>();
  }
  return [];
}