findProjectRoot static method
Walk up from startDir to find the project root (contains pubspec.yaml).
Implementation
static String? findProjectRoot(String startDir) {
var dir = Directory(startDir);
while (true) {
if (File(p.join(dir.path, 'pubspec.yaml')).existsSync()) return dir.path;
final parent = dir.parent;
if (parent.path == dir.path) return null;
dir = parent;
}
}