diff --git a/packages/flutter_tools/lib/src/build_system/targets/assets.dart b/packages/flutter_tools/lib/src/build_system/targets/assets.dart index 25210689d2..6080f117fe 100644 --- a/packages/flutter_tools/lib/src/build_system/targets/assets.dart +++ b/packages/flutter_tools/lib/src/build_system/targets/assets.dart @@ -34,6 +34,11 @@ Future copyAssets(Environment environment, Directory outputDirectory) a assetBundle.entries.entries.map>((MapEntry entry) async { final PoolResource resource = await pool.request(); try { + // This will result in strange looking files, for example files with `/` + // on Windows or files that end up getting URI encoded such as `#.ext` + // to `%23.ext`. However, we have to keep it this way since the + // platform channels in the framework will URI encode these values, + // and the native APIs will look for files this way. final File file = fs.file(fs.path.join(outputDirectory.path, entry.key)); outputs.add(file); file.parent.createSync(recursive: true); diff --git a/packages/flutter_tools/lib/src/bundle.dart b/packages/flutter_tools/lib/src/bundle.dart index 206d70f7b9..e3799bf53b 100644 --- a/packages/flutter_tools/lib/src/bundle.dart +++ b/packages/flutter_tools/lib/src/bundle.dart @@ -195,6 +195,11 @@ Future writeBundle( assetEntries.entries.map>((MapEntry entry) async { final PoolResource resource = await pool.request(); try { + // This will result in strange looking files, for example files with `/` + // on Windows or files that end up getting URI encoded such as `#.ext` + // to `%23.ext`. However, we have to keep it this way since the + // platform channels in the framework will URI encode these values, + // and the native APIs will look for files this way. final File file = fs.file(fs.path.join(bundleDir.path, entry.key)); file.parent.createSync(recursive: true); await file.writeAsBytes(await entry.value.contentsAsBytes());