PROJECT_PATH top-level property

Future<String> get PROJECT_PATH

项目地址

Implementation

Future<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 (directory == null || !File(join(directory, 'pubspec.yaml')).existsSync()) {
    throw FileSystemException('not the root path of the flutter or dart project', directory);
  }
  return directory;
}