gather Products With Branches
fun <Error class: unknown class>.gatherProductsWithBranches(predicate: (<Error class: unknown class>) -> Boolean? = null): List<ProductWithBranches>
Gathers all Products in the current document and their branches. The predicate is used to filter the products. If it is null, all products are returned.
The function traverses the product tree and collects all branches that lead to a product (leaf nodes). It fills a list with ProductWithBranches objects, each containing the product and its path in the tree.
Return
A list of ProductWithBranches objects, each containing a product and its path in the tree.
Parameters
predicate
A function that takes a Product and returns a Boolean. If null, all products are included.