text
stringlengths
1
372
to learn more about app size, see measuring your app’s size.
for detailed information on these flags, run
the help command for your specific target, for example:
if these flags are not listed in the output,
run flutter --version to check your version of flutter.
<topic_end>
<topic_start>
read an obfuscated stack trace
to debug a stack trace created by an obfuscated app,
use the following steps to make it human readable:
find the matching symbols file.
for example, a crash from an android arm64
device would need app.android-arm64.symbols.
provide both the stack trace (stored in a file)
and the symbols file to the flutter symbolize command.
for example:
for more information on the symbolize command,
run flutter symbolize -h.
<topic_end>
<topic_start>
read an obfuscated name
to make the name that an app obfuscated human readable,
use the following steps:
to save the name obfuscation map at app build time,
use --extra-gen-snapshot-options=--save-obfuscation-map=/<your-path>.
for example:
to recover the name, use the generated obfuscation map.
the obfuscation map is a flat JSON array with pairs of
original names and obfuscated names. for example,
["materialapp", "ex", "scaffold", "ey"], where ex
is the obfuscated name of MaterialApp.
<topic_end>
<topic_start>
caveat
be aware of the following when coding an app that will
eventually be an obfuscated binary.
<code_start>
expect(foo.runtimeType.toString(), equals('Foo'));
<code_end>
<topic_end>
<topic_start>
create flavors of a flutter app
<topic_end>
<topic_start>
what are flavors
have you ever wondered how to set up different environments in your flutter app?
flavors (known as build configurations in iOS and macOS), allow you (the developer) to
create separate environments for your app using the same code base.
for example, you might have one flavor for your full-fledged production app,
another as a limited “free” app, another for testing experimental features, and so on.
say you want to make both free and paid versions of your flutter app.
you can use flavors to set up both app versions
without writing two separate apps.
for example, the free version of the app has basic functionality and ads.
in contrast, the paid version has basic app functionality, extra features,
different styles for paid users, and no ads.
you also might use flavors for feature development.
if you’ve built a new feature and want to try it out,
you could set up a flavor to test it out.
your production code remains unaffected
until you’re ready to deploy your new feature.
flavors let you define compile-time configurations
and set parameters that are read at runtime to customize
your app’s behavior.
this document guides you through setting up flutter flavors for iOS, macOS, and android.
<topic_end>
<topic_start>
environment set up
prerequisites:
to set up flavors in iOS and macOS, you’ll define build configurations in xcode.
<topic_end>
<topic_start>
creating flavors in iOS and macOS
open your project in xcode.
select product > scheme > new scheme from the menu to
add a new scheme.
duplicate the build configurations to differentiate between the
default configurations that are already available and the new configurations
for the free scheme.
info note
your configurations should be based on your debug.xconfig or release.xcconfig
file, not the Pods-Runner.xcconfigs. you can check this by expanding the configuration names.
to match the free flavor, add -free
at the end of each new configuration name.
change the free scheme to match the build configurations already created.
<topic_end>
<topic_start>
using flavors in iOS and macOS
now that you’ve set up your free flavor,
you can, for example, add different product bundle identifiers per flavor.
a bundle identifier uniquely identifies your application.
in this example, we set the debug-free value to equal
com.flavor-test.free.
change the app bundle identifier to differentiate between schemes.
in product bundle identifier, append .free to each -free scheme value.
in the build settings, set the product name value to match each flavor.
for example, add debug free.
add the display name to info.plist. update the bundle display name
value to $(product_name).
now you have set up your flavor by making a free scheme