This generates a starter configuration with sensible defaults:
refractor.yaml
# Refractor configuration# Modeled after analysis_options.yaml for Dart developer familiarity.# See: https://github.com/yardexx/refractor# Global tool settings.refractor: # Output path for the symbol map (original → obfuscated name mapping). # symbol_map: build/refractor_map.json # Scope is fixed to the current project (pubspec package + current folder). # Library URI/path exclusions using glob patterns. # exclude: # - "**/*.g.dart" # - "**/*.freezed.dart"# Pass configuration — enable/disable and configure each pass.# Use `true` for defaults, `false` to disable, or a map for custom settings.passes: rename: # preserve_main: true string_encrypt: true # string_encrypt: # xor_key: 0x5A # exclude_patterns: # - "^https://" dead_code: false# Verbose logging.# verbose: false
You can customize the output path with refractor init --output config/refractor.yaml
3
Run your first build
Compile, obfuscate, and build your application:
refractor build
Output:
✓ Compiling lib/main.dart to kernel...✓ Applying obfuscation passes... → rename → string_encrypt✓ Building executable...✓ Writing symbol map...✓ Build complete: build/out.exe
By default, Refractor:
Compiles lib/main.dart
Outputs to build/out.exe (or .dill, .aot, .jit depending on target)
Applies only the passes enabled in refractor.yaml
4
Test your obfuscated binary
Run the generated executable:
./build/out.exe
The application should run normally, but the internal code is now obfuscated!