text
stringlengths
1
372
in xcode and setting the build configurations for that scheme.
for more information, skip to the launching your app flavors
section at the end of this document.
<topic_end>
<topic_start>
plugin configurations
if your app uses a flutter plugin, you need to update
ios/Podfile (if developing for iOS) and macos/Podfile (if developing for macOS).
<topic_end>
<topic_start>
using flavors in android
setting up flavors in android can be done in your project’s
build.gradle file.
inside your flutter project,
navigate to android/app/build.gradle.
create a flavorDimension to group your added product flavors.
gradle doesn’t combine product flavors that share the same dimension.
add a productFlavors object with the desired flavors along
with values for dimension, resValue,
and applicationId or applicationIdSuffix.
<topic_end>
<topic_start>
setting up launch configurations
next, add a launch.json file; this allows you to run the command
flutter run --flavor [environment name].
in VSCode, set up the launch configurations as follows:
you can now run the terminal command
flutter run --flavor free or you can set up a run
configuration in your IDE.
<topic_end>
<topic_start>
launching your app flavors
for examples of build flavors for iOS, macOS, and android,
check out the integration test samples in the flutter repo.
<topic_end>
<topic_start>
retrieving your app’s flavor at runtime
from your dart code, you can use the appFlavor API to determine what
flavor your app was built with.
<topic_end>
<topic_start>
conditionally bundling assets based on flavor
if you aren’t familiar with how to add assets to your app, see
adding assets and images.
if you have assets that are only used in a specific flavor in your app, you can
configure them to only be bundled into your app when building for that flavor.
this prevents your app bundle size from being bloated by unused assets.
here is an example:
in this example, files within the assets/common/ directory will always be bundled
when app is built during flutter run or flutter build. files within the
assets/free/ directory are bundled only when the --flavor option is set
to free. similarly, files within the assets/premium directory are
bundled only if --flavor is set to premium.
<topic_end>
<topic_start>
more information
for more information on creating and using flavors, check out
the following resources:
<topic_end>
<topic_start>
packages
for packages that support creating flavors, check out the following:
<topic_end>
<topic_start>
build and release an android app
during a typical development cycle,
you test an app using flutter run at the command line,
or by using the run and debug
options in your IDE. by default,
flutter builds a debug version of your app.
when you’re ready to prepare a release version of your app,
for example to publish to the google play store,
this page can help. before publishing,
you might want to put some finishing touches on your app.
this page covers the following topics:
info note
throughout this page, [project] refers to
the directory that your application is in. while following
these instructions, substitute [project] with
your app’s directory.
<topic_end>
<topic_start>
adding a launcher icon
when a new flutter app is created, it has a default launcher icon.
to customize this icon, you might want to check out the
flutter_launcher_icons package.
alternatively, you can do it manually using the following steps:
review the material design product
icons guidelines for icon design.
in the [project]/android/app/src/main/res/ directory,
place your icon files in folders named using
configuration qualifiers.
the default mipmap- folders demonstrate the correct
naming convention.
in AndroidManifest.xml, update the
application tag’s android:icon
attribute to reference icons from the previous
step (for example,
<application android:icon="@mipmap/ic_launcher" ...).
to verify that the icon has been replaced,