referencedLibrary property

LibraryElement? get referencedLibrary

If the target imports or exports a LibraryElement, returns it.

Implementation

LibraryElement? get referencedLibrary {
  switch (this) {
    case final ExportDirective directive:
      return directive.libraryExport?.exportedLibrary;
    case final ImportDirective directive:
      return directive.libraryImport?.importedLibrary;
    default:
      return null;
  }
}