ancestors method
Produces an iterator over Path and its ancestors. e.g. with UnixPath, /a/b/c will produce /a/b/c, /a/b, /a, and /.
Implementation
Iterable<UnixPath> ancestors() sync* {
yield this;
UnixPath? current = parent();
while (current != null) {
yield current;
current = current.parent();
}
}