stealth_enum_generator
2.2.7, released 3 weeks ago by aslamambiloly.2bd.net
Code generator that transforms private enums into obfuscated extension types.
What it does
The companion build_runner code generator for stealth_enum. It transforms @StealthEnum() annotated private Dart enums into zero-cost, obfuscated Dart 3 extension types to eliminate AOT binary metadata and neutralize reverse engineering pipelines.
AI-written summary of version 2.2.7, based on the package's README and metadata. Report an inaccuracy
Use it when
- You want to eliminate AOT binary metadata for sensitive enums in Dart or Flutter apps.
- You need deterministic 32-bit hex values derived via keyed HMAC-SHA256 for enum constants.
Skip it when
- You do not use code generation or build_runner in your project.
- You want standard, native Dart enums without obfuscation layers.
Strengths
- Zero-cost obfuscated extension types that remove AOT binary metadata.
- Keyed HMAC-SHA256 derivation ensuring mathematical irreversibility.
- Integrates seamlessly with SharedPartBuilder alongside other code generators.
Weaknesses
- Requires build_runner and code generation setup.
- Requires careful secret key management and build.yaml configuration.
Setup
- Kind
- Pure Dart
- Effort
- Low
- Code generation
- Yes (build_runner)
- Direct dependencies
- 5
Add stealth_enum to dependencies, build_runner and stealth_enum_generator to dev_dependencies, and optionally configure a secret key in build.yaml.
dependencies:
stealth_enum: ^2.2.7
dev_dependencies:
build_runner: ^2.4.0
stealth_enum_generator: ^2.2.7Alternatives
Packages that do the same job and could replace stealth_enum_generator.
- copy_with_extension
Annotation for generating copyWith extensions code using copy_with_extension_gen.
87Compare - masamune
A Flutter framework that uses code generation to scaffold apps with built‑in state, routing, forms and theming.
77Compare - json_annotation
Provides annotations for json_serializable to generate JSON (de)serialization code.
84Compare - copy_with_extension_gen
Generate type‑safe copyWith extensions for annotated classes and record typedefs.
85Compare
Works with
Packages commonly used together with stealth_enum_generator: ones it builds on, ones built on it, and its own family.
- analyzerstealth_enum_generator depends on itPerforms static analysis of Dart code for tool integration and embedding.
- cryptostealth_enum_generator depends on itProvides SHA, MD5, and HMAC hashing functions for Dart.
- buildstealth_enum_generator depends on itPackage for authoring build_runner compatible code generators.
- source_genstealth_enum_generator depends on itSource code generation builders and utilities for the Dart build system.
- stealth_enumstealth_enum_generator depends on itObfuscates Dart enums into zero-cost extension types to eliminate metadata from binaries.
- build_runnerUsed togetherA build system for Dart code generation and modular compilation.