parsePackageConfig function
Parse the package config of the given directory.
Throws if the parsing fails, such as if the file is badly formatted or does not exists.
Implementation
Future<PackageConfig> parsePackageConfig(Directory directory) async {
final packageConfigFile = directory.packageConfig;
return PackageConfig.parseBytes(
await packageConfigFile.readAsBytes(),
packageConfigFile.uri,
);
}