PROJECT_PATH top-level property
项目地址
Implementation
FutureOr<String> get PROJECT_PATH async {
final String directory;
if (Platform.isWindows) {
final result = await runExecutableArguments('cd', []);
directory = (result.stdout as String).replaceAll('\r\n', '');
} else {
directory = Platform.environment['PWD'] ?? '';
}
if (!File(path.join(directory, 'pubspec.yaml')).existsSync()) {
throw FileSystemException('not the root path of the flutter or dart project', directory);
}
return directory;
}