Library findOrCreateLibraryFor(Element e)

This is used when we might need a Library object that isn't actually a documentation entry point (for elements that have no Library within the set of canonical Libraries).

Source

Library findOrCreateLibraryFor(Element e) {
  // This is just a cache to avoid creating lots of libraries over and over.
  if (_allLibraries.containsKey(e.library)) {
    return _allLibraries[e.library];
  }
  // can be null if e is for dynamic
  if (e.library == null) {
    return null;
  }
  Library foundLibrary = findLibraryFor(e);

  if (foundLibrary == null) {
    foundLibrary = new Library._(e.library, this);
    _allLibraries[e.library] = foundLibrary;
  }
  return foundLibrary;
}