buildPackageGraph method

  1. @override
Future<PackageGraph> buildPackageGraph()
override

Implementation

@override
Future<PackageGraph> buildPackageGraph() async {
  if (!config.sdkDocs) {
    if (config.topLevelPackageMeta.requiresFlutter &&
        config.flutterRoot == null) {
      throw DartdocOptionError(
          'Top level package requires Flutter but FLUTTER_ROOT environment variable not set');
    }
    if (config.topLevelPackageMeta.needsPubGet) {
      config.topLevelPackageMeta.runPubGet(config.flutterRoot);
    }
  }

  var rendererFactory = RendererFactory.forFormat(config.format);

  await _calculatePackageMap();

  var newGraph = PackageGraph.uninitialized(
    config,
    sdk,
    hasEmbedderSdkFiles,
    rendererFactory,
    packageMetaProvider,
  );
  await getLibraries(newGraph);
  await newGraph.initializePackageGraph();
  return newGraph;
}