From f2342a61417a5b38aa3bad1d60451b47a2217e3e Mon Sep 17 00:00:00 2001 From: Jason Simmons Date: Tue, 13 Dec 2016 13:43:28 -0800 Subject: [PATCH] Provide an empty asset manifest if the FLX does not contain any assets (#7243) Without this, an FLX with no assets may be completely empty in AOT mode. This will result in a warning when the engine's unzip library tries to parse the FLX. Fixes https://github.com/flutter/flutter/issues/7060 --- packages/flutter_tools/lib/src/asset.dart | 1 + packages/flutter_tools/test/asset_bundle_test.dart | 8 ++++++++ 2 files changed, 9 insertions(+) diff --git a/packages/flutter_tools/lib/src/asset.dart b/packages/flutter_tools/lib/src/asset.dart index 61d7cd7b1a..36a8cf8811 100644 --- a/packages/flutter_tools/lib/src/asset.dart +++ b/packages/flutter_tools/lib/src/asset.dart @@ -111,6 +111,7 @@ class AssetBundle { } if (manifest == null) { // No manifest file found for this application. + entries.add(new AssetBundleEntry.fromString('AssetManifest.json', '{}')); return 0; } if (manifest != null) { diff --git a/packages/flutter_tools/test/asset_bundle_test.dart b/packages/flutter_tools/test/asset_bundle_test.dart index 626d02ee7f..54990a43bb 100644 --- a/packages/flutter_tools/test/asset_bundle_test.dart +++ b/packages/flutter_tools/test/asset_bundle_test.dart @@ -61,4 +61,12 @@ void main() { expect(assetContents, UTF8.decode(entry.contentsAsBytes())); }); }); + + group('AssetBundle.build', () { + test('nonempty', () async { + AssetBundle ab = new AssetBundle(); + expect(await ab.build(), 0); + expect(ab.entries.length, greaterThan(0)); + }); + }); }