changeNodeIndex method

void changeNodeIndex(
  1. Node<E> node,
  2. dynamic index
)

changes the index of the node in the list, if index is -1 then it will be moved to the end of the list this is used on drag start to move the dragged node to the end of the list so that it will be drawn on top

Implementation

void changeNodeIndex(Node<E> node, index) {
  _nodes.remove(node);
  _nodes.insert(index == -1 ? math.max(_nodes.length - 1, 0) : index, node);
}