parsePackageConfig function

Future<PackageConfig> parsePackageConfig(
  1. Directory directory
)

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,
  );
}