getProjectRoot function
Implementation
Directory getProjectRoot() {
var dir = Directory.current;
while (!File('${dir.path}/pubspec.yaml').existsSync()) {
final parent = dir.parent;
if (parent.path == dir.path) {
throw Exception("❌ Could not find pubspec.yaml");
}
dir = parent;
}
return dir;
}