File tree 1 file changed +5
-2
lines changed
1 file changed +5
-2
lines changed Original file line number Diff line number Diff line change @@ -167,15 +167,17 @@ class Library extends ModelElement
167
167
'"$_restoredUri " must not start with "file:"' );
168
168
// Strip the package prefix if the library is part of the default package
169
169
// or if it is being documented remotely.
170
- var packageToHide = package.documentedWhere == DocumentLocation .remote
170
+ var defaultPackage = package.documentedWhere == DocumentLocation .remote
171
171
? package.packageMeta
172
172
: package.packageGraph.packageMeta;
173
- var schemaToHide = 'package:$packageToHide /' ;
173
+ var packageNameToHide = defaultPackage.toString ().toLowerCase ();
174
+ var schemaToHide = 'package:$packageNameToHide /' ;
174
175
175
176
nameFromPath = _restoredUri;
176
177
if (nameFromPath.startsWith (schemaToHide)) {
177
178
nameFromPath = nameFromPath.substring (schemaToHide.length);
178
179
}
180
+ // Remove the trailing `.dart`.
179
181
if (nameFromPath.endsWith ('.dart' )) {
180
182
const dartExtensionLength = '.dart' .length;
181
183
nameFromPath = nameFromPath.substring (
@@ -184,6 +186,7 @@ class Library extends ModelElement
184
186
} else {
185
187
nameFromPath = name;
186
188
}
189
+ // Turn `package:foo/bar/baz` into `package-foo_bar_baz`.
187
190
return nameFromPath.replaceAll (':' , '-' ).replaceAll ('/' , '_' );
188
191
}();
189
192
You can’t perform that action at this time.
0 commit comments