parsePubspec function
Parse the pubspec of the given directory.
Throws if the parsing fails, such as if the file is badly formatted or does not exists.
Implementation
Future<Pubspec> parsePubspec(Directory directory) async {
return Pubspec.parse(await directory.pubspec.readAsString());
}