add method

dynamic add({
  1. String? incomeId,
  2. TraverseQueue? bufferQueue,
  3. required List<NodeInput> items,
})

Implementation

add({
  String? incomeId,
  TraverseQueue? bufferQueue,
  required List<NodeInput> items,
}) {
  items.forEach((itm) {
    var item = this.find((NodeOutput el) {
      return el.id == itm.id;
    });
    if (item == null && bufferQueue != null) {
      item = bufferQueue.find((NodeOutput el) {
        return el.id == itm.id;
      });
    }
    if (item != null && incomeId != null) {
      item.passedIncomes.add(incomeId);
      return;
    }
    List<String> incomes = incomeId == null ? [] : [incomeId];
    List<String> renderIncomes = incomeId == null ? [] : [incomeId];
    this.s.add(NodeOutput(
          id: itm.id,
          next: itm.next,
          passedIncomes: incomes,
          renderIncomes: renderIncomes,
          childrenOnMatrix: 0,
          isAnchor: false,
        ));
  });
}