diff --git a/packages/flutter_tools/lib/src/zip.dart b/packages/flutter_tools/lib/src/zip.dart index 9231aedbf5..158efbc1e6 100644 --- a/packages/flutter_tools/lib/src/zip.dart +++ b/packages/flutter_tools/lib/src/zip.dart @@ -88,15 +88,23 @@ class _ZipToolBuilder extends ZipBuilder { } } + static const List _kNoCompressFileExtensions = const ['.png', '.jpg']; + + bool isAssetCompressed(AssetBundleEntry entry) { + return !_kNoCompressFileExtensions.any( + (String extension) => entry.archivePath.endsWith(extension) + ); + } + Iterable _getCompressedNames() { return entries - .where((AssetBundleEntry entry) => !entry.isStringEntry) + .where(isAssetCompressed) .map((AssetBundleEntry entry) => entry.archivePath); } Iterable _getStoredNames() { return entries - .where((AssetBundleEntry entry) => entry.isStringEntry) + .where((AssetBundleEntry entry) => !isAssetCompressed(entry)) .map((AssetBundleEntry entry) => entry.archivePath); } }