path method

List<T> path(
  1. T start,
  2. T target
)

Returns the shortest detected path from start to target.

  • Returns an empty list if no path was found.

Implementation

List<T> path(T start, T target) {
  final tree = mappedTree(start, target);
  return tree.containsKey(target)
      ? <T>[start, ...tree[target]!.first]
      : <T>[];
}