diff --git a/packages/flutter_tools/lib/src/compile.dart b/packages/flutter_tools/lib/src/compile.dart index cfdffcd4ca..e247969688 100644 --- a/packages/flutter_tools/lib/src/compile.dart +++ b/packages/flutter_tools/lib/src/compile.dart @@ -131,7 +131,7 @@ class PackageUriMapper { if (fileSystemScheme != null && fileSystemRoots != null && prefix.contains(fileSystemScheme)) { _packageName = packageName; _uriPrefixes = fileSystemRoots - .map((String name) => Uri.file('$name/lib/', windows: platform.isWindows).toString()) + .map((String name) => Uri.file(name, windows: platform.isWindows).toString()) .toList(); return; } diff --git a/packages/flutter_tools/test/compile_test.dart b/packages/flutter_tools/test/compile_test.dart index bbaad0c2d8..79f9d267e0 100644 --- a/packages/flutter_tools/test/compile_test.dart +++ b/packages/flutter_tools/test/compile_test.dart @@ -65,12 +65,12 @@ example:file:///example/lib/ const String multiRootPackagesContents = r''' xml:file:///Users/flutter_user/.pub-cache/hosted/pub.dartlang.org/xml-3.2.3/lib/ yaml:file:///Users/flutter_user/.pub-cache/hosted/pub.dartlang.org/yaml-2.1.15/lib/ -example:org-dartlang-app:///lib/ +example:org-dartlang-app:/ '''; when(mockFile.readAsBytesSync()).thenReturn(utf8.encode(multiRootPackagesContents)); testUsingContext('Maps main file from same package on multiroot scheme', () async { - final PackageUriMapper packageUriMapper = PackageUriMapper('/example/lib/main.dart', '.packages', 'org-dartlang-app', ['/example', '/gen']); + final PackageUriMapper packageUriMapper = PackageUriMapper('/example/lib/main.dart', '.packages', 'org-dartlang-app', ['/example/lib/', '/gen/lib/']); expect(packageUriMapper.map('/example/lib/main.dart').toString(), 'package:example/main.dart'); }, overrides: { FileSystem: () => mockFileSystem,