In Flutter, is there a way to add assets for debug builds only? Or to strip them from release builds?
The idea is to generate the play- and app-store screenshots from inside the app. Those screenshots are composed of various images that are otherwise unused and hence shouldn't be included in the release build. Question is, can those assets somehow be removed from release builds?
As an alternative, would it be possible to load the images from the Flutter project directory while the app is running in debug mode? -or at the emulator?
Could the test folder, perhaps, be abused for it?
How would you approach that requirement?
Any advise is welcome, Thank you.
You can define a flavor for the build, and have assets defined for the flavor. From the docs:
flutter:
assets:
- assets/common/
- path: assets/free/
flavors:
- free
- path: assets/premium/
flavors:
- premium
The flavor is specified by passing --flavor <name>
as an argument to flutter build
.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With