Obfuscating Dart Code
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
Step 1 - Modify the "build aot" call
Add the following flag to the build aot call in the
Define this flag as follows:
local extra_gen_snapshot_options_or_none="" if [[ -n "$EXTRA_GEN_SNAPSHOT_OPTIONS" ]]; then extra_gen_snapshot_options_or_none="--extra-gen-snapshot-options=$EXTRA_GEN_SNAPSHOT_OPTIONS" fi
Step 2 - Apply your changes In the project root of your app, run the following two commands:
git commit -am "Enable obfuscation on iOS" flutter
Step 3 - Modify the release config
<ProjectRoot>/ios/Flutter/Release.xcconfig, add the following line:
For information on obfuscating the Android host, see Enabling Proguard in Preparing an Android App for Release.