Repository navigation
Support different set of assets depending on --flavor xxx #21682
Copy link
Copy link
Labels
P2Important issues not at the top of the work listImportant issues not at the top of the work lista: assetsPackaging, accessing, or using assetsPackaging, accessing, or using assetsa: sizeReducing IPA/APK/JS sizesReducing IPA/APK/JS sizesc: new featureNothing broken; request for a new capabilityNothing broken; request for a new capabilityc: performanceRelates to speed or footprint issues (see "perf:" labels)Relates to speed or footprint issues (see "perf:" labels)customer: crowdAffects or could affect many people, though not necessarily a specific customer.Affects or could affect many people, though not necessarily a specific customer.design docTracks a design discussion documentTracks a design discussion documentperf: app sizePerformance issues related to app size (binary/code size) or disk spacePerformance issues related to app size (binary/code size) or disk spacer: fixedIssue is closed as already fixed in a newer versionIssue is closed as already fixed in a newer versionteam-toolOwned by Flutter Tool teamOwned by Flutter Tool teamtoolAffects the "flutter" command-line tool. See also t: labels.Affects the "flutter" command-line tool. See also t: labels.triaged-toolTriaged by Flutter Tool teamTriaged by Flutter Tool team
Description
Edit by @christopherfujino
A design doc for this proposal is at https://flutter.dev/go/flavor-specific-assets
I want to create different flavors of the app and they differ (among other things) on the used assets (icons, backgrounds, fonts, logos, ...)
Currently this seems to require to modify pubspec.yaml before running flutter build
but that is cumbersome.
I'd prefer something like
flutter_assets.yaml # shared assets
flutter_assets_chocolate.yaml # additional assets for chocolate flavor
flutter_assets_strawberry.yaml # additional assets for strawberry flavor
where the shared assets and the assets where the file suffix matches the --flavor xxx value are merged and the result used for flutter build.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
P2Important issues not at the top of the work listImportant issues not at the top of the work lista: assetsPackaging, accessing, or using assetsPackaging, accessing, or using assetsa: sizeReducing IPA/APK/JS sizesReducing IPA/APK/JS sizesc: new featureNothing broken; request for a new capabilityNothing broken; request for a new capabilityc: performanceRelates to speed or footprint issues (see "perf:" labels)Relates to speed or footprint issues (see "perf:" labels)customer: crowdAffects or could affect many people, though not necessarily a specific customer.Affects or could affect many people, though not necessarily a specific customer.design docTracks a design discussion documentTracks a design discussion documentperf: app sizePerformance issues related to app size (binary/code size) or disk spacePerformance issues related to app size (binary/code size) or disk spacer: fixedIssue is closed as already fixed in a newer versionIssue is closed as already fixed in a newer versionteam-toolOwned by Flutter Tool teamOwned by Flutter Tool teamtoolAffects the "flutter" command-line tool. See also t: labels.Affects the "flutter" command-line tool. See also t: labels.triaged-toolTriaged by Flutter Tool teamTriaged by Flutter Tool team
Activity
sestegra commentedon Dec 18, 2018
@zoechi
Shared assets could be defined in
pubspec.yaml. What do you think ?zoechi commentedon Dec 18, 2018
@sestegra I don't think it's a good idea to define them in
pubspec.yaml, but as far as I am aware there are people drawing plans about that topic with better insight already than I have.sestegra commentedon Dec 18, 2018
See my proposal #25487
sestegra commentedon Dec 19, 2018
@zoechi Sample project is available here
https://github.com/sestegra/flutter_assets_flavors
yousifk commentedon Jun 22, 2019
@sestegra
I check your project,that all asset adds to apk becuase
https://flutter.dev/docs/development/ui/assets-and-images#from-packages
SceenShot about analysis apk
https://imgur.com/2HmGHC1
sestegra commentedon Jun 22, 2019
@yousifk Good remark, but I won't have time to update my pull request #25487 to support further versions. In fact, this pull request only supports Flutter 1.0.0.
Moreover, I guess that Flutter team wouldn't integrate it in short terms.
I suggest you to develop some scripts to update
pubspec.yamlwhen compiling different flavors and/or targets.yousifk commentedon Jun 25, 2019
@sestegra
Thanks so much ... I do it .bat script
I will share it at github
droplet-js commentedon Aug 14, 2019
any update?
ljg-7f commentedon Oct 10, 2019
#41094
This PR is mainly for the specific loading of resources for the flavor, and does not consider the factors of platform and mode. If you consider platform and mode, the idea is similar to the PR. The resources that need to be distinguished according to flavor/platform/mode are uniformly placed in a folder, and the name of the folder is specified by --flavor-assets-dir (or other parameters), so that it allows you to filter specific resources based on the flavor/platform/mode information in this folder.
jonahwilliams commentedon Nov 15, 2019
@Hixie do you recall the format you described several weeks (months) ago?
PandaGeek1024 commentedon Dec 10, 2019
55 remaining items
andrewkolos commentedon Aug 1, 2023
I've written a proposal in the form of a design document, Flavor-specific Assets. This will be discussed in the next Dash Forum (August 8th, US time).
giaur500 commentedon Aug 2, 2023
Regarding to flavors, there is one more thing to be discussed. You probably know how it works with native Android apps. You can declare
mainresources and all flavors will use them, unless you overwrite any item for specific flavor. So, there's not need to duplicate assets, if you don't define any flavor specific one, default will be used.As far as I understand, all ideas that have been considered here assume full set of assets for each flavor, so some assets must be actually duplicated.
andrewkolos commentedon Aug 2, 2023
Duplicate declaration (or any kind of duplicate work) is something the designs try to avoid. For all the pubspec-based proposals on the design doc (as of 8/2), the user would only need to declare every asset (or asset directory) once. Said another way:
flavor.group, if choose to implement such a syntax).I'll try to revise the document to make that aspect more clear. Also, anyone can comment on the doc using the comments feature in google docs, so feel free to add a comment to a part of the doc if it seems confusing.
Support conditional bundling of assets based on `--flavor` (#132985)
Reverts "Support conditional bundling of assets based on `--flavor`" (#…
passsy commentedon Dec 9, 2023
Related #65065
github-actions commentedon Dec 23, 2023
This thread has been automatically locked since there has not been any recent activity after it was closed. If you are still experiencing a similar issue, please open a new bug, including the output of
flutter doctor -vand a minimal reproduction of the issue.