Obfuscating Dart Code

Shams Zakhour edited this page Sep 27, 2018 · 6 revisions

Code obfuscation hides function and class names in your compiled Dart code, making it difficult for an attacker to reverse engineer your proprietary app.

Note that Dart obfuscation has not yet been thoroughly tested. Please file a bug if you experience any issues. For more information, see this issue on Stack Overflow.


Add the following line to <ProjectRoot>/android/gradle.properties:


For information on obfuscating the Android host, see Enabling Proguard in Preparing an Android App for Release.


Step 1 - Modify the "build aot" call

Add the following flag to the build aot call in the <ProjectRoot>/packages/flutter_tools/bin/xcode_backend.sh file:


Define this flag as follows:

local extra_gen_snapshot_options_or_none=""
if [[ -n "$EXTRA_GEN_SNAPSHOT_OPTIONS" ]]; then

Step 2 - Modify the release config

In <ProjectRoot>/ios/Flutter/Release.xcconfig, add the following line:

Clone this wiki locally
You can’t perform that action at this time.
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.
Press h to open a hovercard with more details.