addLibraryToGraph method

void addLibraryToGraph(
  1. DartDocResolvedLibrary resolvedLibrary
)

Call during initialization to add a library to this PackageGraph.

Libraries added in this manner are assumed to be part of documented packages, even if includes or embedder.yaml files cause these to span packages.

Implementation

void addLibraryToGraph(DartDocResolvedLibrary resolvedLibrary) {
  assert(!allLibrariesAdded);
  var libraryElement = resolvedLibrary.element;
  var packageMeta =
      packageMetaProvider.fromElement(libraryElement, config.sdkDir);
  if (packageMeta == null) {
    throw DartdocFailure(packageMetaProvider.getMessageForMissingPackageMeta(
        libraryElement, config));
  }
  var lib = Library.fromLibraryResult(
      resolvedLibrary, this, Package.fromPackageMeta(packageMeta, this));
  packageMap[packageMeta.name].libraries.add(lib);
  allLibraries[libraryElement.source.fullName] = lib;
}