From 8d5c2540ea37ecc1e603772c643df6351d89cfad Mon Sep 17 00:00:00 2001 From: Jason Simmons Date: Tue, 9 Aug 2016 15:50:17 -0700 Subject: [PATCH] Create an empty zip file in ZipToolBuilder if the entry list is empty (#5311) This can happen if you build an FLX in release mode for an app with no assets (such as the hello_world example) --- packages/flutter_tools/lib/src/zip.dart | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/packages/flutter_tools/lib/src/zip.dart b/packages/flutter_tools/lib/src/zip.dart index 1c7b79b9f30..9231aedbf5c 100644 --- a/packages/flutter_tools/lib/src/zip.dart +++ b/packages/flutter_tools/lib/src/zip.dart @@ -50,6 +50,13 @@ class _ZipToolBuilder extends ZipBuilder { @override void createZip(File outFile, Directory zipBuildDir) { + // If there are no assets, then create an empty zip file. + if (entries.isEmpty) { + List zipData = new ZipEncoder().encode(new Archive()); + outFile.writeAsBytesSync(zipData); + return; + } + if (outFile.existsSync()) outFile.deleteSync();