File tree 1 file changed +13
-4
lines changed
packages/core/lib/generators
1 file changed +13
-4
lines changed Original file line number Diff line number Diff line change @@ -50,10 +50,19 @@ class AssetsGenConfig {
50
50
}
51
51
52
52
/// Merge the deferred assets with the main assets.
53
- List <Object > _buildAssetsList (Config config) => [
54
- ...config.pubspec.flutter.assets,
55
- ...? config.pubspec.flutter.deferredComponents
56
- ];
53
+ List <Object > _buildAssetsList (Config config) {
54
+ // We may have several deferred components, with a list of assets for each.
55
+ // So before spreading the list of deferred components, we need to spread
56
+ // the list of assets for each deferred component.
57
+ final List <Object > deferredAssets = [];
58
+ config.pubspec.flutter.deferredComponents? .forEach ((deferredComponent) {
59
+ // Include all manipulated assets to the list of deferred assets.
60
+ deferredAssets.addAll (deferredComponent.assets ?? []);
61
+ });
62
+
63
+ // Merge the deferred assets with the main assets.
64
+ return [...config.pubspec.flutter.assets, ...deferredAssets];
65
+ }
57
66
58
67
String generateAssets (
59
68
AssetsGenConfig config,
You can’t perform that action at this time.
0 commit comments