-
Notifications
You must be signed in to change notification settings - Fork 1
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. This can be enabled with the --obfuscate
option, which is required to be paired with --split-debug-info
to generate a symbol map.
As of flutter 1.16.2, the information below is out of date. Only use this if you're on an earlier version of Flutter. If you are using Flutter 1.16.2 or later, please refer to Obfuscating Dart code on flutter.dev.
Add the following line to <ProjectRoot>/android/gradle.properties
:
extra-gen-snapshot-options=--obfuscate
For information on obfuscating the Android host, see Enabling Proguard in Preparing an Android App for Release.
Add the following flag to the build aot
call in the <FlutterRoot>/packages/flutter_tools/bin/xcode_backend.sh
file:
${extra_gen_snapshot_options_or_none}
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
In <ProjectRoot>/ios/Flutter/Release.xcconfig
, add the following line:
EXTRA_GEN_SNAPSHOT_OPTIONS=--obfuscate
- Home of the Wiki
- Roadmap
- API Reference (stable)
- API Reference (master)
- Glossary
- Contributor Guide
- Chat on Discord
- Code of Conduct
- Issue triage reports
- Our Values
- Tree hygiene
- Issue hygiene and Triage
- Style guide for Flutter repo
- Project teams
- Contributor access
- What should I work on?
- Running and writing tests
- Release process
- Rolling Dart
- Manual Engine Roll with Breaking Commits
- Updating Material Design Fonts & Icons
- Postmortems
- Setting up the Framework development environment
- The Framework architecture
- The flutter tool
- API Docs code block generation
- Running examples
- Using the Dart analyzer
- The flutter run variants
- Test coverage for package:flutter
- Writing a golden-file test for package:flutter
- Setting up the Engine development environment
- Compiling the engine
- Debugging the engine
- Using Sanitizers with the Flutter Engine
- Testing the engine
- The Engine architecture
- Flutter's modes
- Engine disk footprint
- Comparing AOT Snapshot Sizes
- Custom Flutter engine embedders
- Custom Flutter Engine Embedding in AOT Mode
- Flutter engine operation in AOT Mode
- Engine-specific Service Protocol extensions
- Crashes
- Supporting legacy platforms
- Metal on iOS FAQ
- Engine Clang Tidy Linter
- Why we have a separate engine repo
- Reduce Flutter engine size with MLGO
- Setting up the Plugins development environment
- Setting up the Packages development environment
- Plugins and Packages repository structure
- Plugin Tests
- Contributing to Plugins and Packages
- Releasing a Plugin or Package
- Unexpected Plugins and Packages failures