Overview
ThePassOptions class contains configuration settings that control the behavior of obfuscation passes. It’s created from the refractor.yaml configuration file and passed to passes via PassContext.
Source: lib/src/engine/runner/pass_options.dart:4
Constructor
Glob patterns for library URIs/paths to skip during obfuscation. Common patterns:
**/*.g.dart, **/*.freezed.dart.If
true, the top-level main() function is not renamed. Set to false only if you have a custom entry point.Regular expressions for string literals that should not be encrypted. Example:
^https:// to preserve URLs.If
true, enables detailed logging during obfuscation. Useful for debugging.Properties
excludeLibraryUriPatterns
URI/path patterns for libraries to skip entirely. Used by
PassContext.shouldObfuscateLibrary().preserveMain
Controls whether the
main() entry point is renamed. Default is true (don’t rename).main?
- Dart requires a top-level
main()function as the entry point - Renaming it would break execution
- Set to
falseonly if you have a custom entry point mechanism
stringExcludePatterns
Regular expressions for string literals that should not be encrypted by
StringEncryptPass.verbose
Enables verbose logging. When
true, passes log detailed information about transformations.Loading from refractor.yaml
PassOptions is typically constructed from the refractor.yaml configuration file:
ConfigManager parses this YAML and creates a PassOptions instance:
Default Values
When options are not specified inrefractor.yaml, these defaults are used:
| Option | Default | Description |
|---|---|---|
excludeLibraryUriPatterns | [] | No exclusions (obfuscate all project code) |
preserveMain | true | Keep main() function name |
stringExcludePatterns | [] | No exclusions (encrypt all strings) |
verbose | false | No detailed logging |
Usage in Passes
Passes accessPassOptions through PassContext:
Validation
Invalid configurations are detected when loadingrefractor.yaml:
See Also
PassContext
Provides access to PassOptions
refractor.yaml
Complete configuration reference
Library Exclusions
Guide to excluding generated files
Pass Interface
Base class that receives options via context