List<Node> filterByLevel(List<Node> nodes, int? level) { return nodes.where((node) => getNodeData(node)?.depth == level).toList(); }