backtrace function

List backtrace(
  1. dynamic node
)

Backtrace according to the parent records and return the path. (including both start and end nodes) @param {Node} node End node @return {Array.<Array.

Implementation

List backtrace(node) {
    var path = [[node.x, node.y]];
    while (node.parent != null) {
        node = node.parent;
        path.add([node.x, node.y]);
    }
    return path.reversed.toList();
}