From f17b68d2d3be915d6066fdc7ab016a25340a2a53 Mon Sep 17 00:00:00 2001 From: Jason Simmons Date: Thu, 24 Mar 2016 11:20:11 -0700 Subject: [PATCH] Add embedded font assets to the asset list Any font asset referenced in the fonts section of flutter.yaml will now be included in the FLX assets. It's no longer necessary to separately list the font in the assets section. --- packages/flutter_tools/lib/src/flx.dart | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/packages/flutter_tools/lib/src/flx.dart b/packages/flutter_tools/lib/src/flx.dart index ca293f5f33..d9e89dacb1 100644 --- a/packages/flutter_tools/lib/src/flx.dart +++ b/packages/flutter_tools/lib/src/flx.dart @@ -81,6 +81,23 @@ Map<_Asset, List<_Asset>> _parseAssets(Map manifestDescriptor, } } } + + // Add assets referenced in the fonts section of the manifest. + if (manifestDescriptor.containsKey('fonts')) { + for (Map family in manifestDescriptor['fonts']) { + List> fonts = family['fonts']; + if (fonts == null) continue; + + for (Map font in fonts) { + String asset = font['asset']; + if (asset == null) continue; + + _Asset baseAsset = new _Asset(base: assetBase, key: asset); + result[baseAsset] = <_Asset>[]; + } + } + } + return result; }