find static method

JustProject? find(
  1. String start
)

The project holding start — the nearest folder at or above it with a pubspec.yaml — or null when there is none.

Implementation

static JustProject? find(String start) {
  var dir = Directory(start).absolute;
  while (true) {
    if (File('${dir.path}/$pubspec').existsSync()) {
      return JustProject(dir.path);
    }
    final parent = dir.parent;
    if (parent.path == dir.path) return null;
    dir = parent;
  }
}