pubspec property

File get pubspec

Implementation

File get pubspec {
  final file = File('${directory.path}/pubspec.yaml');
  if (file.existsSync()) {
    return file;
  } else {
    final shortFile = File('${directory.path}/pubspec.yml');
    if (shortFile.existsSync()) {
      return shortFile;
    }
  }
  throw Exception('pubspec of "$name" package not found.');
}