File tree Expand file tree Collapse file tree 1 file changed +11
-6
lines changed Expand file tree Collapse file tree 1 file changed +11
-6
lines changed Original file line number Diff line number Diff line change @@ -13,7 +13,6 @@ import 'package:dartdoc/src/model/model.dart';
1313/// Like [Parameter] , it doesn't have doc pages, but participates in lookups.
1414/// Forwards to its referenced library if referred to directly.
1515class Prefix extends ModelElement with HasNoPage {
16-
1716 @override
1817 final PrefixElement2 element;
1918
@@ -27,15 +26,21 @@ class Prefix extends ModelElement with HasNoPage {
2726 // TODO(jcollins-g): consider connecting PrefixElement to the imported library
2827 // in analyzer?
2928 late final Library associatedLibrary =
30- getModelForElement (_getImportedLibraryElement () ! ) as Library ;
29+ getModelForElement (_importedLibraryElement ) as Library ;
3130
32- LibraryElement2 ? _getImportedLibraryElement () {
31+ LibraryElement2 get _importedLibraryElement {
3332 final importLists =
3433 library.element.fragments.map ((fragment) => fragment.libraryImports2);
35- return importLists
34+ var libraryImport = importLists
3635 .expand ((import) => import)
37- .firstWhere ((i) => i.prefix2? .element == element)
38- .importedLibrary2;
36+ .firstWhere ((i) => i.prefix2? .element == element);
37+ var importedLibrary = libraryImport.importedLibrary2;
38+ if (importedLibrary == null ) {
39+ throw StateError (
40+ 'Unexpected null LibraryElement2 for imported library at '
41+ '${libraryImport .uri }' );
42+ }
43+ return importedLibrary;
3944 }
4045
4146 @override
You can’t perform that action at this time.
0 commit comments